Package com.sun.star.loader

Examples of com.sun.star.loader.CannotActivateFactoryException


          // 2.
          clazz = Class.forName( implementationName );
     
    }
    catch (java.net.MalformedURLException e) {
      CannotActivateFactoryException cae = new CannotActivateFactoryException(
          "Can not activate factory because " + e.toString() );
      cae.fillInStackTrace();
      throw cae;
    }
    catch (java.io.IOException e) {
      CannotActivateFactoryException cae = new CannotActivateFactoryException(
          "Can not activate factory because " + e.toString() );
      cae.fillInStackTrace();
      throw cae;
    }
    catch (java.lang.ClassNotFoundException e) {
      CannotActivateFactoryException cae = new CannotActivateFactoryException(
          "Can not activate factory because " + e.toString() );
      cae.fillInStackTrace();
      throw cae;
    }

        if (null == clazz)
        {
            CannotActivateFactoryException cae =
                new CannotActivateFactoryException(
                    "Cannot determine activation class!" );
      cae.fillInStackTrace();
      throw cae;
        }
       
    Class[] paramTypes = {String.class, XMultiServiceFactory.class, XRegistryKey.class};                               
    Object[] params = { implementationName, multiServiceFactory, xKey };
   
        // try to get factory from implemetation class
        // latest style: use the public static method __getComponentFactory
        // - new style: use the public static method __getServiceFactory
        // - old style: use the public static method getServiceFactory ( DEPRECATED )

        Method compfac_method = null;
    try
        {
       compfac_method = clazz.getMethod(
                "__getComponentFactory", new Class [] { String.class } );
    }
    catch ( NoSuchMethodException noSuchMethodEx) {}
    catch ( SecurityException secEx) {}
       
        Method method = null;
        if (null == compfac_method)
        {
            try {
                method = clazz.getMethod("__getServiceFactory", paramTypes);
            }
            catch ( NoSuchMethodException noSuchMethodEx) {
                method = null;
            }
            catch ( SecurityException secEx) {
                method = null;
            }
        }
       
    try {
            if (null != compfac_method)
            {
                Object ret = compfac_method.invoke( clazz, new Object [] { implementationName } );
                if (null == ret || !(ret instanceof XSingleComponentFactory))
                {
                    throw new CannotActivateFactoryException(
                        "No factory object for " + implementationName );
                }
                return (XSingleComponentFactory)ret;
            }
            else
            {
                if ( method == null ) {
                    method = clazz.getMethod("getServiceFactory", paramTypes);
                }
               
                Object oRet = method.invoke(clazz, params);
               
                if ( (oRet != null) && (oRet instanceof XSingleServiceFactory) ) {
                    returnObject = (XSingleServiceFactory) oRet;           
                }
            }
      }
    catch ( NoSuchMethodException e) {
            throw new CannotActivateFactoryException("Can not activate the factory for "
                        + implementationName + " because " + e.toString() );
    }
    catch ( SecurityException e) {
            throw new CannotActivateFactoryException("Can not activate the factory for "
            + implementationName + " because " + e.toString() );
    }
    catch ( IllegalAccessException e ) {
      throw new CannotActivateFactoryException("Can not activate the factory for "
            + implementationName + " because " + e.toString() );
    }
    catch ( IllegalArgumentException e ) {
      throw new CannotActivateFactoryException("Can not activate the factory for "
            + implementationName + " because " + e.toString() );
    }
    catch ( InvocationTargetException e ) {
      throw new CannotActivateFactoryException("Can not activate the factory for "
            + implementationName + " because " + e.getTargetException().toString() );
    }
     
    return returnObject;
  }
View Full Code Here


          // 2.
          clazz = Class.forName( implementationName );
     
    }
    catch (java.net.MalformedURLException e) {
      CannotActivateFactoryException cae = new CannotActivateFactoryException(
          "Can not activate factory because " + e.toString() );
      cae.fillInStackTrace();
      throw cae;
    }
    catch (java.io.IOException e) {
      CannotActivateFactoryException cae = new CannotActivateFactoryException(
          "Can not activate factory because " + e.toString() );
      cae.fillInStackTrace();
      throw cae;
    }
    catch (java.lang.ClassNotFoundException e) {
      CannotActivateFactoryException cae = new CannotActivateFactoryException(
          "Can not activate factory because " + e.toString() );
      cae.fillInStackTrace();
      throw cae;
    }

        if (null == clazz)
        {
            CannotActivateFactoryException cae =
                new CannotActivateFactoryException(
                    "Cannot determine activation class!" );
      cae.fillInStackTrace();
      throw cae;
        }
       
    Class[] paramTypes = {String.class, XMultiServiceFactory.class, XRegistryKey.class};                               
    Object[] params = { implementationName, multiServiceFactory, xKey };
   
        // try to get factory from implemetation class
        // latest style: use the public static method __getComponentFactory
        // - new style: use the public static method __getServiceFactory
        // - old style: use the public static method getServiceFactory ( DEPRECATED )

        Method compfac_method = null;
    try
        {
       compfac_method = clazz.getMethod(
                "__getComponentFactory", new Class [] { String.class } );
    }
    catch ( NoSuchMethodException noSuchMethodEx) {}
    catch ( SecurityException secEx) {}
       
        Method method = null;
        if (null == compfac_method)
        {
            try {
                method = clazz.getMethod("__getServiceFactory", paramTypes);
            }
            catch ( NoSuchMethodException noSuchMethodEx) {
                method = null;
            }
            catch ( SecurityException secEx) {
                method = null;
            }
        }
       
    try {
            if (null != compfac_method)
            {
                Object ret = compfac_method.invoke( clazz, new Object [] { implementationName } );
                if (null == ret || !(ret instanceof XSingleComponentFactory))
                {
                    throw new CannotActivateFactoryException(
                        "No factory object for " + implementationName );
                }
                return (XSingleComponentFactory)ret;
            }
            else
            {
                if ( method == null ) {
                    method = clazz.getMethod("getServiceFactory", paramTypes);
                }
               
                Object oRet = method.invoke(clazz, params);
               
                if ( (oRet != null) && (oRet instanceof XSingleServiceFactory) ) {
                    returnObject = (XSingleServiceFactory) oRet;           
                }
            }
      }
    catch ( NoSuchMethodException e) {
            throw new CannotActivateFactoryException("Can not activate the factory for "
                        + implementationName + " because " + e.toString() );
    }
    catch ( SecurityException e) {
            throw new CannotActivateFactoryException("Can not activate the factory for "
            + implementationName + " because " + e.toString() );
    }
    catch ( IllegalAccessException e ) {
      throw new CannotActivateFactoryException("Can not activate the factory for "
            + implementationName + " because " + e.toString() );
    }
    catch ( IllegalArgumentException e ) {
      throw new CannotActivateFactoryException("Can not activate the factory for "
            + implementationName + " because " + e.toString() );
    }
    catch ( InvocationTargetException e ) {
      throw new CannotActivateFactoryException("Can not activate the factory for "
            + implementationName + " because " + e.getTargetException().toString() );
    }
     
    return returnObject;
  }
View Full Code Here

          // 2.
          clazz = Class.forName( implementationName );
     
    }
    catch (java.net.MalformedURLException e) {
      CannotActivateFactoryException cae = new CannotActivateFactoryException(
          "Can not activate factory because " + e.toString() );
      cae.fillInStackTrace();
      throw cae;
    }
    catch (java.io.IOException e) {
      CannotActivateFactoryException cae = new CannotActivateFactoryException(
          "Can not activate factory because " + e.toString() );
      cae.fillInStackTrace();
      throw cae;
    }
    catch (java.lang.ClassNotFoundException e) {
      CannotActivateFactoryException cae = new CannotActivateFactoryException(
          "Can not activate factory because " + e.toString() );
      cae.fillInStackTrace();
      throw cae;
    }

        if (null == clazz)
        {
            CannotActivateFactoryException cae =
                new CannotActivateFactoryException(
                    "Cannot determine activation class!" );
      cae.fillInStackTrace();
      throw cae;
        }
       
    Class[] paramTypes = {String.class, XMultiServiceFactory.class, XRegistryKey.class};                               
    Object[] params = { implementationName, multiServiceFactory, xKey };
   
        // try to get factory from implemetation class
        // latest style: use the public static method __getComponentFactory
        // - new style: use the public static method __getServiceFactory
        // - old style: use the public static method getServiceFactory ( DEPRECATED )

        Method compfac_method = null;
    try
        {
       compfac_method = clazz.getMethod(
                "__getComponentFactory", new Class [] { String.class } );
    }
    catch ( NoSuchMethodException noSuchMethodEx) {}
    catch ( SecurityException secEx) {}
       
        Method method = null;
        if (null == compfac_method)
        {
            try {
                method = clazz.getMethod("__getServiceFactory", paramTypes);
            }
            catch ( NoSuchMethodException noSuchMethodEx) {
                method = null;
            }
            catch ( SecurityException secEx) {
                method = null;
            }
        }
       
    try {
            if (null != compfac_method)
            {
                Object ret = compfac_method.invoke( clazz, new Object [] { implementationName } );
                if (null == ret || !(ret instanceof XSingleComponentFactory))
                {
                    throw new CannotActivateFactoryException(
                        "No factory object for " + implementationName );
                }
                return (XSingleComponentFactory)ret;
            }
            else
            {
                if ( method == null ) {
                    method = clazz.getMethod("getServiceFactory", paramTypes);
                }
               
                Object oRet = method.invoke(clazz, params);
               
                if ( (oRet != null) && (oRet instanceof XSingleServiceFactory) ) {
                    returnObject = (XSingleServiceFactory) oRet;           
                }
            }
      }
    catch ( NoSuchMethodException e) {
            throw new CannotActivateFactoryException("Can not activate the factory for "
                        + implementationName + " because " + e.toString() );
    }
    catch ( SecurityException e) {
            throw new CannotActivateFactoryException("Can not activate the factory for "
            + implementationName + " because " + e.toString() );
    }
    catch ( IllegalAccessException e ) {
      throw new CannotActivateFactoryException("Can not activate the factory for "
            + implementationName + " because " + e.toString() );
    }
    catch ( IllegalArgumentException e ) {
      throw new CannotActivateFactoryException("Can not activate the factory for "
            + implementationName + " because " + e.toString() );
    }
    catch ( InvocationTargetException e ) {
      throw new CannotActivateFactoryException("Can not activate the factory for "
            + implementationName + " because " + e.getTargetException().toString() );
    }
     
    return returnObject;
  }
View Full Code Here

          // 2.
          clazz = Class.forName( implementationName );
     
    }
    catch (java.net.MalformedURLException e) {
      CannotActivateFactoryException cae = new CannotActivateFactoryException(
          "Can not activate factory because " + e.toString() );
      cae.fillInStackTrace();
      throw cae;
    }
    catch (java.io.IOException e) {
      CannotActivateFactoryException cae = new CannotActivateFactoryException(
          "Can not activate factory because " + e.toString() );
      cae.fillInStackTrace();
      throw cae;
    }
    catch (java.lang.ClassNotFoundException e) {
      CannotActivateFactoryException cae = new CannotActivateFactoryException(
          "Can not activate factory because " + e.toString() );
      cae.fillInStackTrace();
      throw cae;
    }

        if (null == clazz)
        {
            CannotActivateFactoryException cae =
                new CannotActivateFactoryException(
                    "Cannot determine activation class!" );
      cae.fillInStackTrace();
      throw cae;
        }
       
    Class[] paramTypes = {String.class, XMultiServiceFactory.class, XRegistryKey.class};                               
    Object[] params = { implementationName, multiServiceFactory, xKey };
   
        // try to get factory from implemetation class
        // latest style: use the public static method __getComponentFactory
        // - new style: use the public static method __getServiceFactory
        // - old style: use the public static method getServiceFactory ( DEPRECATED )

        Method compfac_method = null;
    try
        {
       compfac_method = clazz.getMethod(
                "__getComponentFactory", new Class [] { String.class } );
    }
    catch ( NoSuchMethodException noSuchMethodEx) {}
    catch ( SecurityException secEx) {}
       
        Method method = null;
        if (null == compfac_method)
        {
            try {
                method = clazz.getMethod("__getServiceFactory", paramTypes);
            }
            catch ( NoSuchMethodException noSuchMethodEx) {
                method = null;
            }
            catch ( SecurityException secEx) {
                method = null;
            }
        }
       
    try {
            if (null != compfac_method)
            {
                Object ret = compfac_method.invoke( clazz, new Object [] { implementationName } );
                if (null == ret || !(ret instanceof XSingleComponentFactory))
                {
                    throw new CannotActivateFactoryException(
                        "No factory object for " + implementationName );
                }
                return (XSingleComponentFactory)ret;
            }
            else
            {
                if ( method == null ) {
                    method = clazz.getMethod("getServiceFactory", paramTypes);
                }
               
                Object oRet = method.invoke(clazz, params);
               
                if ( (oRet != null) && (oRet instanceof XSingleServiceFactory) ) {
                    returnObject = (XSingleServiceFactory) oRet;           
                }
            }
      }
    catch ( NoSuchMethodException e) {
            throw new CannotActivateFactoryException("Can not activate the factory for "
                        + implementationName + " because " + e.toString() );
    }
    catch ( SecurityException e) {
            throw new CannotActivateFactoryException("Can not activate the factory for "
            + implementationName + " because " + e.toString() );
    }
    catch ( IllegalAccessException e ) {
      throw new CannotActivateFactoryException("Can not activate the factory for "
            + implementationName + " because " + e.toString() );
    }
    catch ( IllegalArgumentException e ) {
      throw new CannotActivateFactoryException("Can not activate the factory for "
            + implementationName + " because " + e.toString() );
    }
    catch ( InvocationTargetException e ) {
      throw new CannotActivateFactoryException("Can not activate the factory for "
            + implementationName + " because " + e.getTargetException().toString() );
    }
     
    return returnObject;
  }
View Full Code Here

          // 2.
          clazz = Class.forName( implementationName );
     
    }
    catch (java.net.MalformedURLException e) {
      CannotActivateFactoryException cae = new CannotActivateFactoryException(
          "Can not activate factory because " + e.toString() );
      cae.fillInStackTrace();
      throw cae;
    }
    catch (java.io.IOException e) {
      CannotActivateFactoryException cae = new CannotActivateFactoryException(
          "Can not activate factory because " + e.toString() );
      cae.fillInStackTrace();
      throw cae;
    }
    catch (java.lang.ClassNotFoundException e) {
      CannotActivateFactoryException cae = new CannotActivateFactoryException(
          "Can not activate factory because " + e.toString() );
      cae.fillInStackTrace();
      throw cae;
    }

        if (null == clazz)
        {
            CannotActivateFactoryException cae =
                new CannotActivateFactoryException(
                    "Cannot determine activation class!" );
      cae.fillInStackTrace();
      throw cae;
        }
       
    Class[] paramTypes = {String.class, XMultiServiceFactory.class, XRegistryKey.class};                               
    Object[] params = { implementationName, multiServiceFactory, xKey };
   
        // try to get factory from implemetation class
        // latest style: use the public static method __getComponentFactory
        // - new style: use the public static method __getServiceFactory
        // - old style: use the public static method getServiceFactory ( DEPRECATED )

        Method compfac_method = null;
    try
        {
       compfac_method = clazz.getMethod(
                "__getComponentFactory", new Class [] { String.class } );
    }
    catch ( NoSuchMethodException noSuchMethodEx) {}
    catch ( SecurityException secEx) {}
       
        Method method = null;
        if (null == compfac_method)
        {
            try {
                method = clazz.getMethod("__getServiceFactory", paramTypes);
            }
            catch ( NoSuchMethodException noSuchMethodEx) {
                method = null;
            }
            catch ( SecurityException secEx) {
                method = null;
            }
        }
       
    try {
            if (null != compfac_method)
            {
                Object ret = compfac_method.invoke( clazz, new Object [] { implementationName } );
                if (null == ret || !(ret instanceof XSingleComponentFactory))
                {
                    throw new CannotActivateFactoryException(
                        "No factory object for " + implementationName );
                }
                return (XSingleComponentFactory)ret;
            }
            else
            {
                if ( method == null ) {
                    method = clazz.getMethod("getServiceFactory", paramTypes);
                }
               
                Object oRet = method.invoke(clazz, params);
               
                if ( (oRet != null) && (oRet instanceof XSingleServiceFactory) ) {
                    returnObject = (XSingleServiceFactory) oRet;           
                }
            }
      }
    catch ( NoSuchMethodException e) {
            throw new CannotActivateFactoryException("Can not activate the factory for "
                        + implementationName + " because " + e.toString() );
    }
    catch ( SecurityException e) {
            throw new CannotActivateFactoryException("Can not activate the factory for "
            + implementationName + " because " + e.toString() );
    }
    catch ( IllegalAccessException e ) {
      throw new CannotActivateFactoryException("Can not activate the factory for "
            + implementationName + " because " + e.toString() );
    }
    catch ( IllegalArgumentException e ) {
      throw new CannotActivateFactoryException("Can not activate the factory for "
            + implementationName + " because " + e.toString() );
    }
    catch ( InvocationTargetException e ) {
      throw new CannotActivateFactoryException("Can not activate the factory for "
            + implementationName + " because " + e.getTargetException().toString() );
    }
     
    return returnObject;
  }
View Full Code Here

          // 2.
          clazz = Class.forName( implementationName );
     
    }
    catch (java.net.MalformedURLException e) {
      CannotActivateFactoryException cae = new CannotActivateFactoryException(
          "Can not activate factory because " + e.toString() );
      cae.fillInStackTrace();
      throw cae;
    }
    catch (java.io.IOException e) {
      CannotActivateFactoryException cae = new CannotActivateFactoryException(
          "Can not activate factory because " + e.toString() );
      cae.fillInStackTrace();
      throw cae;
    }
    catch (java.lang.ClassNotFoundException e) {
      CannotActivateFactoryException cae = new CannotActivateFactoryException(
          "Can not activate factory because " + e.toString() );
      cae.fillInStackTrace();
      throw cae;
    }

        if (null == clazz)
        {
            CannotActivateFactoryException cae =
                new CannotActivateFactoryException(
                    "Cannot determine activation class!" );
      cae.fillInStackTrace();
      throw cae;
        }
       
    Class[] paramTypes = {String.class, XMultiServiceFactory.class, XRegistryKey.class};                               
    Object[] params = { implementationName, multiServiceFactory, xKey };
   
        // try to get factory from implemetation class
        // latest style: use the public static method __getComponentFactory
        // - new style: use the public static method __getServiceFactory
        // - old style: use the public static method getServiceFactory ( DEPRECATED )

        Method compfac_method = null;
    try
        {
       compfac_method = clazz.getMethod(
                "__getComponentFactory", new Class [] { String.class } );
    }
    catch ( NoSuchMethodException noSuchMethodEx) {}
    catch ( SecurityException secEx) {}
       
        Method method = null;
        if (null == compfac_method)
        {
            try {
                method = clazz.getMethod("__getServiceFactory", paramTypes);
            }
            catch ( NoSuchMethodException noSuchMethodEx) {
                method = null;
            }
            catch ( SecurityException secEx) {
                method = null;
            }
        }
       
    try {
            if (null != compfac_method)
            {
                Object ret = compfac_method.invoke( clazz, new Object [] { implementationName } );
                if (null == ret || !(ret instanceof XSingleComponentFactory))
                {
                    throw new CannotActivateFactoryException(
                        "No factory object for " + implementationName );
                }
                return (XSingleComponentFactory)ret;
            }
            else
            {
                if ( method == null ) {
                    method = clazz.getMethod("getServiceFactory", paramTypes);
                }
               
                Object oRet = method.invoke(clazz, params);
               
                if ( (oRet != null) && (oRet instanceof XSingleServiceFactory) ) {
                    returnObject = (XSingleServiceFactory) oRet;           
                }
            }
      }
    catch ( NoSuchMethodException e) {
            throw new CannotActivateFactoryException("Can not activate the factory for "
                        + implementationName + " because " + e.toString() );
    }
    catch ( SecurityException e) {
            throw new CannotActivateFactoryException("Can not activate the factory for "
            + implementationName + " because " + e.toString() );
    }
    catch ( IllegalAccessException e ) {
      throw new CannotActivateFactoryException("Can not activate the factory for "
            + implementationName + " because " + e.toString() );
    }
    catch ( IllegalArgumentException e ) {
      throw new CannotActivateFactoryException("Can not activate the factory for "
            + implementationName + " because " + e.toString() );
    }
    catch ( InvocationTargetException e ) {
      throw new CannotActivateFactoryException("Can not activate the factory for "
            + implementationName + " because " + e.getTargetException().toString() );
    }
     
    return returnObject;
  }
View Full Code Here

          // 2.
          clazz = Class.forName( implementationName );
     
    }
    catch (java.net.MalformedURLException e) {
      CannotActivateFactoryException cae = new CannotActivateFactoryException(
          "Can not activate factory because " + e.toString() );
      cae.fillInStackTrace();
      throw cae;
    }
    catch (java.io.IOException e) {
      CannotActivateFactoryException cae = new CannotActivateFactoryException(
          "Can not activate factory because " + e.toString() );
      cae.fillInStackTrace();
      throw cae;
    }
    catch (java.lang.ClassNotFoundException e) {
      CannotActivateFactoryException cae = new CannotActivateFactoryException(
          "Can not activate factory because " + e.toString() );
      cae.fillInStackTrace();
      throw cae;
    }
           
    Class[] paramTypes = {String.class, XMultiServiceFactory.class, XRegistryKey.class};                               
    Object[] params = { implementationName, multiServiceFactory, xKey };
   
        // try to get factory from implemetation class
        // - new style: use the public static method __getServiceFactory
        // - old style: use the public static method getServiceFactory ( DEPRECATED )
        Method method = null;
    try {
       method = clazz.getMethod("__getServiceFactory", paramTypes);
    }
    catch ( NoSuchMethodException noSuchMethodEx) {
      method = null;
    }
    catch ( SecurityException secEx) {
      method = null;
    }
   
    try {
      if ( method == null ) {
        method = clazz.getMethod("getServiceFactory", paramTypes);
      }
   
      Object oRet = method.invoke(clazz, params);

      if ( (oRet != null) && (oRet instanceof XSingleServiceFactory) ) {
        returnObject = (XSingleServiceFactory) oRet;           
      }
      }
    catch ( NoSuchMethodException noSuchMethodEx) {
      needFactoryWrapper = true;
    }
    catch ( SecurityException secEx) {
      needFactoryWrapper = true;
    }
    catch ( IllegalAccessException e ) {
      throw new CannotActivateFactoryException("Can not activate the factory for "
            + implementationName + " because " + e.toString() );
    }
    catch ( IllegalArgumentException e ) {
      throw new CannotActivateFactoryException("Can not activate the factory for "
            + implementationName + " because " + e.toString() );
    }
    catch ( InvocationTargetException e ) {
      throw new CannotActivateFactoryException("Can not activate the factory for "
            + implementationName + " because " + e.getTargetException().toString() );
    }
    // if no method is found make a factory wrapper for the implementation and return it
      if ( needFactoryWrapper ) {
        DEBUG ("create factory wrapper for " + implementationName);
View Full Code Here

          // 2.
          clazz = Class.forName( implementationName );
     
    }
    catch (java.net.MalformedURLException e) {
      CannotActivateFactoryException cae = new CannotActivateFactoryException(
          "Can not activate factory because " + e.toString() );
      cae.fillInStackTrace();
      throw cae;
    }
    catch (java.io.IOException e) {
      CannotActivateFactoryException cae = new CannotActivateFactoryException(
          "Can not activate factory because " + e.toString() );
      cae.fillInStackTrace();
      throw cae;
    }
    catch (java.lang.ClassNotFoundException e) {
      CannotActivateFactoryException cae = new CannotActivateFactoryException(
          "Can not activate factory because " + e.toString() );
      cae.fillInStackTrace();
      throw cae;
    }

        if (null == clazz)
        {
            CannotActivateFactoryException cae =
                new CannotActivateFactoryException(
                    "Cannot determine activation class!" );
      cae.fillInStackTrace();
      throw cae;
        }
       
    Class[] paramTypes = {String.class, XMultiServiceFactory.class, XRegistryKey.class};                               
    Object[] params = { implementationName, multiServiceFactory, xKey };
   
        // try to get factory from implemetation class
        // latest style: use the public static method __getComponentFactory
        // - new style: use the public static method __getServiceFactory
        // - old style: use the public static method getServiceFactory ( DEPRECATED )

        Method compfac_method = null;
    try
        {
       compfac_method = clazz.getMethod(
                "__getComponentFactory", new Class [] { String.class } );
    }
    catch ( NoSuchMethodException noSuchMethodEx) {}
    catch ( SecurityException secEx) {}
       
        Method method = null;
        if (null == compfac_method)
        {
            try {
                method = clazz.getMethod("__getServiceFactory", paramTypes);
            }
            catch ( NoSuchMethodException noSuchMethodEx) {
                method = null;
            }
            catch ( SecurityException secEx) {
                method = null;
            }
        }
       
    try {
            if (null != compfac_method)
            {
                Object ret = compfac_method.invoke( clazz, new Object [] { implementationName } );
                if (null == ret || !(ret instanceof XSingleComponentFactory))
                {
                    throw new CannotActivateFactoryException(
                        "No factory object for " + implementationName );
                }
                return (XSingleComponentFactory)ret;
            }
            else
            {
                if ( method == null ) {
                    method = clazz.getMethod("getServiceFactory", paramTypes);
                }
               
                Object oRet = method.invoke(clazz, params);
               
                if ( (oRet != null) && (oRet instanceof XSingleServiceFactory) ) {
                    returnObject = (XSingleServiceFactory) oRet;           
                }
            }
      }
    catch ( NoSuchMethodException e) {
            throw new CannotActivateFactoryException("Can not activate the factory for "
                        + implementationName + " because " + e.toString() );
    }
    catch ( SecurityException e) {
            throw new CannotActivateFactoryException("Can not activate the factory for "
            + implementationName + " because " + e.toString() );
    }
    catch ( IllegalAccessException e ) {
      throw new CannotActivateFactoryException("Can not activate the factory for "
            + implementationName + " because " + e.toString() );
    }
    catch ( IllegalArgumentException e ) {
      throw new CannotActivateFactoryException("Can not activate the factory for "
            + implementationName + " because " + e.toString() );
    }
    catch ( InvocationTargetException e ) {
      throw new CannotActivateFactoryException("Can not activate the factory for "
            + implementationName + " because " + e.getTargetException().toString() );
    }
     
    return returnObject;
  }
View Full Code Here

          // 2.
          clazz = Class.forName( implementationName );
     
    }
    catch (java.net.MalformedURLException e) {
      CannotActivateFactoryException cae = new CannotActivateFactoryException(
          "Can not activate factory because " + e.toString() );
      cae.fillInStackTrace();
      throw cae;
    }
    catch (java.io.IOException e) {
      CannotActivateFactoryException cae = new CannotActivateFactoryException(
          "Can not activate factory because " + e.toString() );
      cae.fillInStackTrace();
      throw cae;
    }
    catch (java.lang.ClassNotFoundException e) {
      CannotActivateFactoryException cae = new CannotActivateFactoryException(
          "Can not activate factory because " + e.toString() );
      cae.fillInStackTrace();
      throw cae;
    }

        if (null == clazz)
        {
            CannotActivateFactoryException cae =
                new CannotActivateFactoryException(
                    "Cannot determine activation class!" );
      cae.fillInStackTrace();
      throw cae;
        }
       
    Class[] paramTypes = {String.class, XMultiServiceFactory.class, XRegistryKey.class};                               
    Object[] params = { implementationName, multiServiceFactory, xKey };
   
        // try to get factory from implemetation class
        // latest style: use the public static method __getComponentFactory
        // - new style: use the public static method __getServiceFactory
        // - old style: use the public static method getServiceFactory ( DEPRECATED )

        Method compfac_method = null;
    try
        {
       compfac_method = clazz.getMethod(
                "__getComponentFactory", new Class [] { String.class } );
    }
    catch ( NoSuchMethodException noSuchMethodEx) {}
    catch ( SecurityException secEx) {}
       
        Method method = null;
        if (null == compfac_method)
        {
            try {
                method = clazz.getMethod("__getServiceFactory", paramTypes);
            }
            catch ( NoSuchMethodException noSuchMethodEx) {
                method = null;
            }
            catch ( SecurityException secEx) {
                method = null;
            }
        }
       
    try {
            if (null != compfac_method)
            {
                Object ret = compfac_method.invoke( clazz, new Object [] { implementationName } );
                if (null == ret || !(ret instanceof XSingleComponentFactory))
                {
                    throw new CannotActivateFactoryException(
                        "No factory object for " + implementationName );
                }
                return (XSingleComponentFactory)ret;
            }
            else
            {
                if ( method == null ) {
                    method = clazz.getMethod("getServiceFactory", paramTypes);
                }
               
                Object oRet = method.invoke(clazz, params);
               
                if ( (oRet != null) && (oRet instanceof XSingleServiceFactory) ) {
                    returnObject = (XSingleServiceFactory) oRet;           
                }
            }
      }
    catch ( NoSuchMethodException e) {
            throw new CannotActivateFactoryException("Can not activate the factory for "
                        + implementationName + " because " + e.toString() );
    }
    catch ( SecurityException e) {
            throw new CannotActivateFactoryException("Can not activate the factory for "
            + implementationName + " because " + e.toString() );
    }
    catch ( IllegalAccessException e ) {
      throw new CannotActivateFactoryException("Can not activate the factory for "
            + implementationName + " because " + e.toString() );
    }
    catch ( IllegalArgumentException e ) {
      throw new CannotActivateFactoryException("Can not activate the factory for "
            + implementationName + " because " + e.toString() );
    }
    catch ( InvocationTargetException e ) {
      throw new CannotActivateFactoryException("Can not activate the factory for "
            + implementationName + " because " + e.getTargetException().toString() );
    }
     
    return returnObject;
  }
View Full Code Here

          // 2.
          clazz = Class.forName( implementationName );
     
    }
    catch (java.net.MalformedURLException e) {
      CannotActivateFactoryException cae = new CannotActivateFactoryException(
          "Can not activate factory because " + e.toString() );
      cae.fillInStackTrace();
      throw cae;
    }
    catch (java.io.IOException e) {
      CannotActivateFactoryException cae = new CannotActivateFactoryException(
          "Can not activate factory because " + e.toString() );
      cae.fillInStackTrace();
      throw cae;
    }
    catch (java.lang.ClassNotFoundException e) {
      CannotActivateFactoryException cae = new CannotActivateFactoryException(
          "Can not activate factory because " + e.toString() );
      cae.fillInStackTrace();
      throw cae;
    }

        if (null == clazz)
        {
            CannotActivateFactoryException cae =
                new CannotActivateFactoryException(
                    "Cannot determine activation class!" );
      cae.fillInStackTrace();
      throw cae;
        }
       
    Class[] paramTypes = {String.class, XMultiServiceFactory.class, XRegistryKey.class};                               
    Object[] params = { implementationName, multiServiceFactory, xKey };
   
        // try to get factory from implemetation class
        // latest style: use the public static method __getComponentFactory
        // - new style: use the public static method __getServiceFactory
        // - old style: use the public static method getServiceFactory ( DEPRECATED )

        Method compfac_method = null;
    try
        {
       compfac_method = clazz.getMethod(
                "__getComponentFactory", new Class [] { String.class } );
    }
    catch ( NoSuchMethodException noSuchMethodEx) {}
    catch ( SecurityException secEx) {}
       
        Method method = null;
        if (null == compfac_method)
        {
            try {
                method = clazz.getMethod("__getServiceFactory", paramTypes);
            }
            catch ( NoSuchMethodException noSuchMethodEx) {
                method = null;
            }
            catch ( SecurityException secEx) {
                method = null;
            }
        }
       
    try {
            if (null != compfac_method)
            {
                Object ret = compfac_method.invoke( clazz, new Object [] { implementationName } );
                if (null == ret || !(ret instanceof XSingleComponentFactory))
                {
                    throw new CannotActivateFactoryException(
                        "No factory object for " + implementationName );
                }
                return (XSingleComponentFactory)ret;
            }
            else
            {
                if ( method == null ) {
                    method = clazz.getMethod("getServiceFactory", paramTypes);
                }
               
                Object oRet = method.invoke(clazz, params);
               
                if ( (oRet != null) && (oRet instanceof XSingleServiceFactory) ) {
                    returnObject = (XSingleServiceFactory) oRet;           
                }
            }
      }
    catch ( NoSuchMethodException e) {
            throw new CannotActivateFactoryException("Can not activate the factory for "
                        + implementationName + " because " + e.toString() );
    }
    catch ( SecurityException e) {
            throw new CannotActivateFactoryException("Can not activate the factory for "
            + implementationName + " because " + e.toString() );
    }
    catch ( IllegalAccessException e ) {
      throw new CannotActivateFactoryException("Can not activate the factory for "
            + implementationName + " because " + e.toString() );
    }
    catch ( IllegalArgumentException e ) {
      throw new CannotActivateFactoryException("Can not activate the factory for "
            + implementationName + " because " + e.toString() );
    }
    catch ( InvocationTargetException e ) {
      throw new CannotActivateFactoryException("Can not activate the factory for "
            + implementationName + " because " + e.getTargetException().toString() );
    }
     
    return returnObject;
  }
View Full Code Here

TOP

Related Classes of com.sun.star.loader.CannotActivateFactoryException

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.