Package org.apache.derby.iapi.sql.dictionary

Examples of org.apache.derby.iapi.sql.dictionary.OptionalTool


        try {
      ClassFactoryContext cfc = (ClassFactoryContext) ContextService.getContext( ClassFactoryContext.CONTEXT_ID );
            ClassFactory    classFactory = cfc.getClassFactory();

            String              toolClassName = findToolClassName( toolName, optionalArgs );           
            OptionalTool    tool = null;

            Class<?> toolClass;
            try {
                toolClass = classFactory.loadApplicationClass( toolClassName );
            }
            catch (ClassNotFoundException cnfe) { throw wrap( cnfe ); }

            if (!OptionalTool.class.isAssignableFrom(toolClass)) {
                throw badCustomTool(toolClassName);
            }

            try {
                tool = (OptionalTool) toolClass.newInstance();
            }
            catch (InstantiationException ie) { throw wrap( ie ); }
            catch (IllegalAccessException iae) { throw wrap( iae ); }

            // Strip the custom tool class name from the optional args as necessary
            if ( CUSTOM_TOOL_CLASS_NAME.equals( toolName ) )
            {
                optionalArgs = stripCustomClassName( optionalArgs );
            }

            if ( register ) { tool.loadTool( optionalArgs ); }
            else { tool.unloadTool( optionalArgs ); }
        }
        catch (StandardException se) { throw PublicAPI.wrapStandardException( se ); }
    }
View Full Code Here


        try {
      CompilerContext cc = (CompilerContext) ContextService.getContext( CompilerContext.CONTEXT_ID );
            ClassFactory    classFactory = cc.getClassFactory();

            String              toolClassName = findToolClassName( toolName, optionalArgs );           
            OptionalTool    tool = null;

            try {
                tool = (OptionalTool) classFactory.loadApplicationClass( toolClassName ).newInstance();
            }
            catch (ClassNotFoundException cnfe) { throw wrap( cnfe ); }
            catch (InstantiationException ie) { throw wrap( ie ); }
            catch (IllegalAccessException iae) { throw wrap( iae ); }

            // Strip the custom tool class name from the optional args as necessary
            if ( CUSTOM_TOOL_CLASS_NAME.equals( toolName ) )
            {
                optionalArgs = stripCustomClassName( optionalArgs );
            }

            if ( register ) { tool.loadTool( optionalArgs ); }
            else { tool.unloadTool( optionalArgs ); }
        }
        catch (StandardException se) { throw PublicAPI.wrapStandardException( se ); }
    }
View Full Code Here

TOP

Related Classes of org.apache.derby.iapi.sql.dictionary.OptionalTool

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.