Examples of BundlePluginDescriptorType


Examples of org.rhq.enterprise.server.xmlschema.generated.serverplugin.bundle.BundlePluginDescriptorType

    public boolean validate(ServerPluginEnvironment env) {
        if (!(env.getPluginDescriptor() instanceof BundlePluginDescriptorType)) {
            log.error("Descriptor was not of the bundle type: " + env.getPluginDescriptor());
            return false;
        }
        BundlePluginDescriptorType descriptor = (BundlePluginDescriptorType) env.getPluginDescriptor();
        if (descriptor.getBundle() == null) {
            log.error("Descriptor missing the bundle type");
            return false;
        }
        if (descriptor.getBundle().getType() == null) {
            log.error("Descriptor missing the bundle type's name attribute");
            return false;
        }
        if (descriptor.getBundle().getType().trim().length() == 0) {
            log.error("Descriptor bundle type's name must be non-zero in length");
            return false;
        }
        return true;
    }
View Full Code Here

Examples of org.rhq.enterprise.server.xmlschema.generated.serverplugin.bundle.BundlePluginDescriptorType

    @Override
    protected void loadPlugin(ServerPluginEnvironment env, boolean enabled) throws Exception {
        if (enabled) {
            // validate some things about this plugin that are specific for bundle functionality

            BundlePluginDescriptorType descriptor = (BundlePluginDescriptorType) env.getPluginDescriptor();
            BundleType bt = descriptor.getBundle();
            if (bt == null || bt.getType() == null || bt.getType().length() == 0) {
                // if the xml parser did its job, this will probably never happen, but just in case, make sure there is
                // a non-null, valid bundle type name - we have other code that expects this to be true
                throw new Exception("The bundle plugin [" + env.getPluginKey().getPluginName()
                    + "] did not specify a valid bundle type in its descriptor");
View Full Code Here

Examples of org.rhq.enterprise.server.xmlschema.generated.serverplugin.bundle.BundlePluginDescriptorType

        }

        // find the plugin environment for the bundle plugin of the given type
        ServerPluginEnvironment pluginEnv = null;
        for (ServerPluginEnvironment env : getPluginEnvironments()) {
            BundlePluginDescriptorType descriptor = (BundlePluginDescriptorType) env.getPluginDescriptor();
            if (bundleTypeName.equals(descriptor.getBundle().getType())) {
                pluginEnv = env;
                break;
            }
        }
View Full Code Here

Examples of org.rhq.enterprise.server.xmlschema.generated.serverplugin.bundle.BundlePluginDescriptorType

        }

        BundleDistributionInfo info = null;

        for (ServerPluginEnvironment env : getPluginEnvironments()) {
            BundlePluginDescriptorType descriptor = (BundlePluginDescriptorType) env.getPluginDescriptor();

            // get the facet and see if this plugin can deal with the recipe
            String pluginName = env.getPluginKey().getPluginName();
            ServerPluginComponent component = getServerPluginComponent(pluginName);
            BundleServerPluginFacet facet = (BundleServerPluginFacet) component; // we know this cast will work because our loadPlugin ensured so
            getLog().debug("Bundle server plugin [" + pluginName + "] is parsing a recipe");
            ClassLoader originalContextClassLoader = Thread.currentThread().getContextClassLoader();
            try {
                Thread.currentThread().setContextClassLoader(env.getPluginClassLoader());
                try {
                    RecipeParseResults results = facet.parseRecipe(recipe);
                    info = new BundleDistributionInfo(recipe, results, null);
                    info.setBundleTypeName(descriptor.getBundle().getType());
                    break;
                } catch (UnknownRecipeException ure) {
                    // the recipe is not a type that the plugin can handle, go on to the next
                    info = null;
                }
View Full Code Here

Examples of org.rhq.enterprise.server.xmlschema.generated.serverplugin.bundle.BundlePluginDescriptorType

        // find the bundle plugin that can handle this distribution and get the distro info
        BundleDistributionInfo info = null;

        for (ServerPluginEnvironment env : getPluginEnvironments()) {
            BundlePluginDescriptorType descriptor = (BundlePluginDescriptorType) env.getPluginDescriptor();

            // get the facet and see if this plugin can deal with the distro
            String pluginName = env.getPluginKey().getPluginName();
            ServerPluginComponent component = getServerPluginComponent(pluginName);
            BundleServerPluginFacet facet = (BundleServerPluginFacet) component; // we know this cast will work because our loadPlugin ensured so
            getLog().debug(
                "Bundle server plugin [" + pluginName + "] is parsing a distribution file [" + distributionFile + "]");
            ClassLoader originalContextClassLoader = Thread.currentThread().getContextClassLoader();
            try {
                Thread.currentThread().setContextClassLoader(env.getPluginClassLoader());
                try {
                    info = facet.processBundleDistributionFile(distributionFile);
                    info.setBundleTypeName(descriptor.getBundle().getType());
                    break;
                } catch (UnknownRecipeException ure) {
                    // the recipe is not a type that the plugin can handle, go on to the next
                    info = null;
                }
View Full Code Here

Examples of org.rhq.enterprise.server.xmlschema.generated.serverplugin.bundle.BundlePluginDescriptorType

    public void testBundlePluginDescriptor() throws Exception {
        String testXml = "test-serverplugin-bundle.xml";
        ServerPluginDescriptorType data = parseTestXml(testXml);
        assert data instanceof BundlePluginDescriptorType;
        BundlePluginDescriptorType descriptor = (BundlePluginDescriptorType) data;

        // check the validity of the root element
        assert descriptor.getApiVersion().equals("1.2");
        assert descriptor.getVersion().equals("2.3");
        assert descriptor.getName().equals("bundle name");
        assert descriptor.getDisplayName().equals("bundle display");
        assert descriptor.getDescription().equals("bundle description");
        assert descriptor.getPackage().equals("bundle.package");
        assert descriptor.getPluginComponent().getClazz().equals("bundle.plugin.component");

        // check the validity of the additional bundle schema elements
        assert descriptor.getBundle().getType().equals("bundle.type.name");

        // check the validity of the plugin config definition
        ConfigurationDescriptor pluginConfigXml = descriptor.getPluginConfiguration();
        assert pluginConfigXml != null : "should have parsed the plugin config";
        ConfigurationDefinition configDef = ConfigurationMetadataParser.parse("test", pluginConfigXml);
        assert configDef != null : "should have parsed the plugin config properties";
        PropertyDefinitionSimple propDef = configDef.getPropertyDefinitionSimple("bundleprop1");
        assert propDef != null : "missing a simple property definition";
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.