Examples of FactoryException


Examples of org.drools.smf.FactoryException

                                                        requiredDeclarations,
                                                        rule )};
        }
        catch ( Exception e )
        {
            throw new FactoryException( e );
        }
    }
View Full Code Here

Examples of org.drools.smf.FactoryException

        String fieldName = config.getAttribute( "field" );
        String fieldValue = config.getAttribute( "value" );

        if ( className == null || className.trim( ).equals( "" ) )
        {
            throw new FactoryException( "no class name specified" );
        }

        if ( fieldName == null || fieldName.trim( ).equals( "" ) )
        {
            throw new FactoryException( "no field name specified" );
        }

        if ( fieldValue == null || fieldValue.trim( ).equals( "" ) )
        {
            throw new FactoryException( "no field value specified" );
        }
        Class clazz = null;
        try
        {
            ClassLoader cl = (ClassLoader) context.get( "smf-classLoader" );
            if ( cl == null )
            {
                cl = Thread.currentThread( ).getContextClassLoader( );
                context.put( "smf-classLoader",
                             cl );
            }

            if ( cl == null )
            {
                cl = getClass( ).getClassLoader( );
                context.put( "smf-classLoader",
                             cl );
            }

            Importer importer = rule.getImporter( );
            clazz = importer.importClass( cl,
                                          className );

            // make sure field getter exists
            clazz.getMethod( "get" + fieldName.toUpperCase( ).charAt( 0 ) + fieldName.substring( 1 ),
                             (Class[]) null );

        }
        catch ( SecurityException e )
        {
            throw new FactoryException( "Field '" + fieldName + "' is not accessible for Class '" + className + "'" );
        }
        catch ( NoSuchMethodException e )
        {
            throw new FactoryException( "Field '" + fieldName + "' does not exist for Class '" + className + "'" );
        }
        catch ( ClassNotFoundException e )
        {
            throw new FactoryException( e.getMessage( ) );
        }
        catch ( Error e )
        {
            throw new FactoryException( e.getMessage( ) );
        }

        return new ClassFieldObjectType( clazz,
                                         fieldName,
                                         fieldValue );
View Full Code Here

Examples of org.drools.smf.FactoryException

        {
            return new BaseImportEntry( config.getText() );
        }
        catch ( Exception e )
        {
            throw new FactoryException( e );
        }
    }
View Full Code Here

Examples of org.drools.smf.FactoryException

    {
        String className = config.getText( ).trim( );

        if ( className == null || className.trim( ).equals( "" ) )
        {
            throw new FactoryException( "no class name specified" );
        }

        Class clazz = null;
        try
        {
            ClassLoader cl = (ClassLoader) context.get( "smf-classLoader" );
            if ( cl == null )
            {
                cl = Thread.currentThread( ).getContextClassLoader( );
                context.put( "smf-classLoader",
                             cl );
            }

            if ( cl == null )
            {
                cl = getClass( ).getClassLoader( );
                context.put( "smf-classLoader",
                             cl );
            }

            Importer importer = rule.getImporter( );
            clazz = importer.importClass( cl,
                                          className );
        }
        catch ( ClassNotFoundException e )
        {
            throw new FactoryException( e.getMessage( ) );
        }
        catch ( Error e )
        {
            throw new FactoryException( e.getMessage( ) );
        }

        return new ClassObjectType( clazz );
    }
View Full Code Here

Examples of org.drools.smf.FactoryException

        String fieldName = "identifier";
        String fieldValue = config.getAttribute( "identifier" );

        if ( className == null || className.trim( ).equals( "" ) )
        {
            throw new FactoryException( "no Semaphore type specified" );
        }
        className = "org.drools.semantics.base." + className + "Semaphore";
       
        if ( fieldValue == null || fieldValue.trim( ).equals( "" ) )
        {
            throw new FactoryException( "no Semaphore identifier specified" );
        }

        try
        {
            ClassLoader cl = Thread.currentThread( ).getContextClassLoader( );
            if ( cl == null )
            {
                cl = getClass().getClassLoader();
            }

            Class clazz = null;
            /* All semaphore types should be in system classloader*/
            try
            {
                clazz = cl.loadClass( className );
            }
            catch ( ClassNotFoundException e )
            {
                // Semaphore type does not exist
                throw new FactoryException( "Unable create Semaphore for type '" + config.getAttribute( "type" ) + "'" );
            }

            // make sure field getter exists
            clazz.getMethod( "get" + fieldName.toUpperCase( ).charAt( 0 ) + fieldName.substring( 1 ),
                             ( Class[] ) null );

            return new ClassFieldObjectType( clazz,
                                             fieldName,
                                             fieldValue );
        }
        catch ( SecurityException e )
        {
            throw new FactoryException( "Field '" + fieldName + "' is not accessible for Class '" + className + "'" );
        }
        catch ( NoSuchMethodException e )
        {
            throw new FactoryException( "Field '" + fieldName + "' does not exist for Class '" + className + "'" );
        }
    }
View Full Code Here

Examples of org.drools.smf.FactoryException

            clazz = importer.importClass( cl,
                                          className );
        }
        catch ( ClassNotFoundException e )
        {
            throw new FactoryException( e.getMessage( ) );
        }
        catch ( Error e )
        {
            throw new FactoryException( e.getMessage( ) );
        }

        return new ApplicationData( ruleSet,
                                    config.getAttribute( "identifier" ),
                                    clazz );
View Full Code Here

Examples of org.drools.smf.FactoryException

                                             rule );

        }
        catch ( Exception e )
        {
            throw new FactoryException( e );
        }
    }
View Full Code Here

Examples of org.drools.smf.FactoryException

                declaration = rule.addParameterDeclaration( identifier,
                                                            type );
            }
            catch ( InvalidRuleException e )
            {
                throw new FactoryException( "xxx" );
            }
        }
        return declaration;
    }
View Full Code Here

Examples of org.drools.smf.FactoryException

                                                      requiredDeclarations,
                                                      rule )};
        }
        catch ( Exception e )
        {
            throw new FactoryException( e );
        }
    }
View Full Code Here

Examples of org.drools.smf.FactoryException

                                      config.getText(),
                                      ruleSet );
        }
        catch ( Exception e )
        {
            throw new FactoryException( e );
        }

    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.