Examples of InvalidPluginException


Examples of com.abiquo.ssm.exception.InvalidPluginException

    @Override
    public StoragePluginMetadata getPluginMetadata()
    {
        if (!this.getClass().isAnnotationPresent(Plugin.class))
        {
            throw new InvalidPluginException("Missing @Plugin annotation in "
                + this.getClass().getName());
        }

        Plugin pluginInfo = this.getClass().getAnnotation(Plugin.class);

        if (pluginInfo.type() == null)
        {
            throw new InvalidPluginException("Plugin type can not be null in "
                + this.getClass().getName());
        }

        StoragePluginMetadata metadata = new StoragePluginMetadata();
        metadata.setDefaultServicePort(pluginInfo.defaultServicePort());
        metadata.setDefaultManagementPort(pluginInfo.defaultManagementPort());
        metadata.setRequiresAuthentication(pluginInfo.requiresAuthentication());
        metadata.setType(pluginInfo.type());

        try
        {
            Method[] methods = StoragePlugin.class.getMethods();
            for (Method methodDefinition : methods)
            {
                if (methodDefinition.isAnnotationPresent(Provides.class))
                {
                    Method implMethod =
                        this.getClass().getMethod(methodDefinition.getName(),
                            methodDefinition.getParameterTypes());

                    if (!implMethod.isAnnotationPresent(UnsupportedOp.class))
                    {
                        Provides provides = methodDefinition.getAnnotation(Provides.class);
                        metadata.getSupportedOperations().add(provides.value());
                    }
                }
            }
        }
        catch (Exception ex)
        {
            throw new InvalidPluginException("Could not get the list of supported operations for plugin: "
                + this.getClass().getName());
        }

        return metadata;
    }
View Full Code Here

Examples of com.google.gerrit.server.plugins.InvalidPluginException

      throws InvalidPluginException {
    Preconditions.checkState(command != null, "pluginName must be provided");
    if (Command.class.isAssignableFrom(type)) {
      Class<Command> old = commands.get(export.value());
      if (old != null) {
        throw new InvalidPluginException(String.format(
            "@Export(\"%s\") has duplicate bindings:\n  %s\n  %s",
            export.value(), old.getName(), type.getName()));
      }
      commands.put(export.value(), (Class<Command>) type);
    } else {
      throw new InvalidPluginException(String.format(
          "Class %s with @Export(\"%s\") must extend %s or implement %s",
          type.getName(), export.value(),
          SshCommand.class.getName(), Command.class.getName()));
    }
  }
View Full Code Here

Examples of com.google.gerrit.server.plugins.InvalidPluginException

  public void export(Export export, Class<?> type)
      throws InvalidPluginException {
    if (HttpServlet.class.isAssignableFrom(type)) {
      Class<HttpServlet> old = serve.get(export.value());
      if (old != null) {
        throw new InvalidPluginException(String.format(
            "@Export(\"%s\") has duplicate bindings:\n  %s\n  %s",
            export.value(), old.getName(), type.getName()));
      }
      serve.put(export.value(), (Class<HttpServlet>) type);
    } else {
      throw new InvalidPluginException(String.format(
          "Class %s with @Export(\"%s\") must extend %s",
          type.getName(), export.value(),
          HttpServlet.class.getName()));
    }
  }
View Full Code Here

Examples of de.innovationgate.wgpublisher.plugins.InvalidPluginException

                        removeContentDB(dbKey);
                        db = null;
                    }
                }           
                catch (Exception e) {
                    throw new InvalidPluginException(plugin, "Error checking existent plugin database " + dbKey, e);
                }
            }

            if (!plugin.isActive()) {
                throw new InvalidPluginException(plugin, "Plugin is deactivated");
            }
            if (!plugin.isValid()) {
                throw new InvalidPluginException(plugin, "Plugin is invalid");
            }

           
            // First connect all mandatory plugins
            try {

                Iterator mandatoryPlugins = plugin.getMandatoryPlugins().values().iterator();
                while (mandatoryPlugins.hasNext()) {
                    WGAPlugin mandatoryPlugin  = (WGAPlugin) mandatoryPlugins.next();
                    connectPlugin(mandatoryPlugin, domainConfigs);
                }
            }
            // A mandatory plugin is invalid. Cancel connect.
            catch (InvalidPluginException e) {
                throw e;
            }
  
            logCategoryInfo("Plugin " + plugin.getInstallationKey(), 2);
           
            // Mandatory db options (for plugins)
            Map<String, String> dbOptions = new HashMap<String, String>();
            dbOptions.put(WGDatabase.COPTION_DBREFERENCE, dbKey.toLowerCase());
            dbOptions.put(WGDatabase.COPTION_READERPROFILECREATION, "true");
            dbOptions.put(WGDatabase.COPTION_USERCACHELATENCY, String.valueOf(_wgaConfiguration.getUserCacheLatencyMinutes()));
           
            // We try to automatically migrate plugin content stores to CS5 format
            dbOptions.put(WGDatabase.COPTION_CONTENT_STORE_VERSION, String.valueOf(WGDatabase.CSVERSION_WGA5));
           
            // Clear the plugin database before connecting if the plugin is updated and should clear the db on update
            if (plugin.getRuntimeContext().isUpdated()) {
                if (plugin.getCsConfig().getPluginConfig() instanceof de.innovationgate.wga.common.beans.csconfig.v3.PluginConfig) {
                    de.innovationgate.wga.common.beans.csconfig.v3.PluginConfig v3Config = (de.innovationgate.wga.common.beans.csconfig.v3.PluginConfig) plugin.getCsConfig().getPluginConfig();
                    if (v3Config.isClearDatabaseOnUpdate()) {
                        getLog().info("Clearing plugin database for installation key " + plugin.getInstallationKey());
                        plugin.getParent().deletePluginDatabase(plugin);
                    }
                }
                plugin.getRuntimeContext().setUpdated(false);
            }
           
            // Connect
            getLog().info("Connecting plugin " + plugin.getPluginID().getUniqueName() + " Version " + plugin.getPluginID().getVersion().toString());
              
            try {
                db = WGFactory.getInstance().openDatabase(null, de.innovationgate.webgate.api.hsql.WGDatabaseImpl.class.getName(), plugin.buildDatabasePath(), null, null, dbOptions);
            }
            catch (Throwable e1) {
                throw new InvalidPluginException(plugin, "Could not connect plugin \"" + plugin.getPluginID().getUniqueName() + "\"", e1);
            }

            if (db == null || !db.isSessionOpen()) {
                throw new InvalidPluginException(plugin, "Could not connect plugin \"" + plugin.getPluginID().getUniqueName() + "\" - Check logged messages above for error details");
            }

            try {
                db.getSessionContext().setTask("Initializing database in WGA");
               
                // Plugin dbs are always CS5 since they are automatically migrated
                //getLog().info("Database of plugin " + plugin.getPluginID().getUniqueName() + " is content store version " + db.getContentStoreVersion());
               
                PluginConfig pc = plugin.getCsConfig().getPluginConfig();
                String auth = pc.getAuthentication();
                db.setTitle(pc.getTitle());
               
               
                // Set mandatory database attributes
                initializeDBAttributes(db, dbKey, dbKey, new HashSet());
               
                // Create authentication
                if (auth != null) {
                    String authImplClass = null;
                    Map<String,String> authOptions = new HashMap<String, String>();
                   
                    // Delegate authentication to the default domain
                    if (auth.equals(PluginConfig.AUTHSOURCE_DEFAULT_DOMAIN)) {
                        authImplClass = WGAAuthModuleFactory.AUTHMODULE_DELEGATE;
                        authOptions.put(DelegatingAuthModule.COPTION_DOMAIN, "default");
                    }
                    // Use some plugin for authentication
                    else {
                        WGAPlugin authPlugin = plugin.getParent().getPluginByUniqueName(auth);
                    if (authPlugin != null) {
                        authImplClass = CSAuthModule.class.getName();
                        authOptions.put(CSAuthModule.COPTION_DBKEY, authPlugin.buildDatabaseKey());
                    }
                    else {
                            getLog().error("Unable to find authentication plugin " + auth);
                        }
                    }
                   
                    if (authImplClass != null) {
                        AuthenticationModule authModule = WGFactory.getAuthModuleFactory().getAuthModule(authImplClass, authOptions, db);
                        db.setAuthenticationModule(authModule);
                    }
                   
                }
               
                // Enforce some plugin settings via db attributes
                db.setAttribute(DBATTRIB_PERSMODE, String.valueOf(pc.getPersonalisationMode()));
                db.setAttribute(DBATTRIB_PERSSTATMODE, String.valueOf(Constants.PERSSTATMODE_SESSION));
                db.setAttribute(DBATTRIB_PLUGIN_FILETIME, new Long(plugin.getFileLastModified()));
                db.setAttribute(DBATTRIB_PLUGIN_ID, plugin.getPluginID());
                db.setAttribute(DBATTRIB_PLUGIN_VERSION, plugin.getPluginID().getVersion());
               
                if (!pc.isUsageAsContentStore()) {
                    db.setAttribute(DBATTRIB_ALLOW_PUBLISHING, "false");
                }
               
                if (!pc.isShowOnStartPage()) {
                    db.setAttribute(DBATTRIB_STARTPAGE, "false");
                }
   
                // Configure design provider
                DesignReference ref = new DesignReference(Constants.DESIGNCOL_PLUGIN, plugin.getInstallationKey(), null);
                db.setDesignProvider(new FileSystemDesignProvider(ref, this, db, plugin.getDesignURL().toString(), Collections.EMPTY_MAP));
                db.setAllowDesignModification(false);
              
                // Determine if ACL is empty
                boolean aclEmpty = false;
                try {
                    if (db.isConnected() && db.hasFeature(WGDatabase.FEATURE_ACL_MANAGEABLE) && db.getACL().getAllEntries().size() == 0) {
                        aclEmpty = true;
                    }
                }
                catch (WGBackendException e1) {
                    getLog().error("Error retrieving ACL state of db '" + db.getDbReference() + "'", e1);
                }
               
                // Process system container
                SystemContainerManager.SystemContainerContext scContext = null;
                try {
                    scContext = _systemContainerManager.addDatabase(db, plugin, aclEmpty);
                }
                catch (Exception e) {
                    this.log.error("Exception processing system file container for plugin '" + plugin.getPluginID().getUniqueName() + "'", e);
                }
                       
                // Build map of publisher options from wga.xml. We only use gobal options here since plugins have no own options in wga.xml
                // and csconfig.xml options are processed via system container
                Map<String, String> publisherOptions = new HashMap<String, String>();
                // publisherOptions.putAll(_globalPublisherOptions); Plugins should not be influenced by global options of the current configuration
                if (scContext != null) {
                    scContext.putPublisherOptions(publisherOptions);
                }
   
                // Publisher options initialisation which is equal for content dbs and plugins
                processPublisherOptions(db, publisherOptions);
               
                // Set plugin homepage. The method chooses either the plugin-specific homepage or the publisher option
                // Must be after publisher option initialisation to be able to react on them
                db.setAttribute(DBATTRIB_HOME_PAGE, plugin.getPluginHomepage());
               
                // check if db is empty before hdb script runs
                boolean isEmptyDB = db.isContentEmpty();
                               
                // Validate default language definition
                if (!isEmptyDB) {
                    db.determineDefaultLanguage();
                }
                                                               
                // System container initialisations
                if (scContext != null) {
                    scContext.performInitialisation(new Boolean(isEmptyDB));
                    if (isEmptyDB) {
                        db.onConnect(new ValidateDefaultLanguageAction());
                    }
                }
               
                // Registering connection
                this.contentdbs.put(db.getDbReference(), db);
                performNewDBOperations(db);
               
                // Mark this database as fully connected
                db.setAttribute(DBATTRIB_FULLY_CONNECTED, "true");
               
                // Initially create field mappings. These can only come from csconfig.xml for plugins
                updateFieldMappings(db, null);
               
                return db;
            }
            catch (Throwable e) {
                try {
                    db.close();
                }
                catch (WGAPIException e2) {
                    // Silent failure of closing an uninitialized plugin bc. the connection failure is more important
                }
                plugin.setValid(false);
                throw new InvalidPluginException(plugin, "Error connecting plugin" ,e);
            }
           
           
           
           
View Full Code Here

Examples of de.kilobyte22.app.kibibyte.exceptions.InvalidPluginException

            if (plugins.get(as) != null)
                throw new PluginAlreadyLoadedException(as);
            Plugin plugin = new Plugin(name, bot, as);
            plugins.put(as, plugin);
        } catch (ClassCastException ex) {
            throw new InvalidPluginException("Plugin class doesn't implement IPlugin");
        }
        /*} catch (ClassCastException ex) {
            // No Plugin
        } catch (ClassNotFoundException e) {
            // No Such Class/broken Manifest
View Full Code Here

Examples of de.kilobyte22.app.kibibyte.exceptions.InvalidPluginException

            this.plugin = pclass.newInstance();
            botAccess = new BotAccess(this.bot, this);
            this.plugin.onLoad(botAccess);
            this.name = name;
        } catch (ClassCastException ex) {
            throw new InvalidPluginException("Main class not found");
        }
    }
View Full Code Here

Examples of de.kilobyte22.app.kibibyte.exceptions.InvalidPluginException

            plugin = pclass.newInstance();
            botAccess = new BotAccess(this.bot, this);
            plugin.onLoad(botAccess);
            this.name = name;
        } catch (ClassCastException ex) {
            throw new InvalidPluginException("Main class not found");
        }
    }
View Full Code Here

Examples of kameleon.exception.InvalidPlugInException

    try {
      ZipFile plugInZip = new ZipFile(plugin) ;
      /* Retrieve plug-in information object */
      ZipEntry infoFileEntry = plugInZip.getEntry(PLUGIN_INFO_FILE_NAME) ;
      if (infoFileEntry == null) {
        throw new InvalidPlugInException(plugin.getName()) ;
      }// if
      PlugInInfo info = (PlugInInfo) IOObject.readObjectFromFile(
          new BufferedInputStream(
              plugInZip.getInputStream(infoFileEntry))) ;

      // Close the zip file in order to copy it
      plugInZip.close() ;

      /* Determine the nature of the plug-in before adding it */
      if (info.isAnalyzer()) {
        addJar(plugin, info, this.analyzerFolder) ;
        addConfiguration(info, this.analyzerConfigFile) ;
        this.am.addAnalyzerInfo(info) ;
      } else {
        addJar(plugin, info, this.generatorFolder) ;
        addConfiguration(info, this.generatorConfigFile) ;
      }// if
      copyImages(info) ;
     
      return info ;
    } catch (ZipException e) {
      throw new InvalidPlugInException(plugin.getName()) ;
    } catch (IOException e) {
      throw new FileReadingException(plugin) ;
    }// try
  }// addPlugIn(File, String, String, String)
View Full Code Here

Examples of kameleon.exception.InvalidPlugInException

       * - InstantiationException
       * - InvocationTargetException
       * - NoSuchMethodException
       * - SecurityException
       */
      throw new InvalidPlugInException(info, e) ;
    }// try
  }// copyImages(ZipFile)
View Full Code Here

Examples of kameleon.exception.InvalidPlugInException

      ClassLoader loader = URLClassLoader.newInstance(
          new URL[] { new File(jarPath).toURI().toURL() }
          ) ;
      return loader ;
    } catch (MalformedURLException e) {
      throw new InvalidPlugInException(info) ;
    }// try
  }// loadPlugIn(PlugInInfo, String, String)
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.