Package org.rhq.enterprise.server.plugin.pc.bundle

Examples of org.rhq.enterprise.server.plugin.pc.bundle.UnknownRecipeException


*/
public class WildflyPatchBundleServerPluginComponent implements ServerPluginComponent, BundleServerPluginFacet {

    @Override
    public RecipeParseResults parseRecipe(String recipe) throws UnknownRecipeException {
        throw new UnknownRecipeException(
            "The Wildfly patches cannot be dealt with using only recipes - the whole distribution file is needed.");
    }
View Full Code Here


        FileInputStream in = new FileInputStream(distributionFile);
        try {
            PatchInfo patchInfo = PatchParser.parse(in, true);

            if (patchInfo == null) {
                throw new UnknownRecipeException();
            }

            if (patchInfo.is(Patch.class)) {
                Patch patch = patchInfo.as(Patch.class);

                String version = patch.getType() == Patch.Type.ONE_OFF ? patch.getTargetVersion() + "+" + patch.getId()
                    : patch.getTargetVersion();

                DeploymentProperties props = new DeploymentProperties(0, patch.getIdentityName(),
                    version, patch.getDescription(), DestinationComplianceMode.full);

                ConfigurationDefinition config = new ConfigurationDefinition("wildfly-patch", null);
                PropertyDefinitionSimple patchIdProp = new PropertyDefinitionSimple("patchId", "The ID of the patch",
                    true,
                    PropertySimpleType.STRING);
                patchIdProp.setDefaultValue(patch.getId());
                patchIdProp.setReadOnly(true);
                PropertyDefinitionSimple patchTypeProp = new PropertyDefinitionSimple("patchType",
                    "The type of the patch",
                    true, PropertySimpleType.STRING);
                patchTypeProp.setDefaultValue(patch.getType().toString());
                patchTypeProp.setReadOnly(true);

                config.put(patchIdProp);
                config.put(patchTypeProp);
                addCommonProperties(config);

                parseResults = new RecipeParseResults(props, config, null);
                fileName = patch.getId();
                recipe = patch.getContents();
            } else if (patchInfo.is(PatchBundle.class)) {
                PatchBundle patchBundle = patchInfo.as(PatchBundle.class);

                Patch lastPatch = null;
                StringBuilder allPatchIds = new StringBuilder();

                for (PatchBundle.Element p : patchBundle) {
                    lastPatch = p.getPatch();
                    allPatchIds.append(p.getPatch().getId()).append("#");
                }
                allPatchIds.replace(allPatchIds.length() - 1, allPatchIds.length(), "");

                if (lastPatch == null) {
                    throw new UnknownRecipeException("Not a Wildfly patch");
                }

                DeploymentProperties props = new DeploymentProperties(0, lastPatch.getIdentityName(),
                    lastPatch.getTargetVersion(), lastPatch.getDescription(), DestinationComplianceMode.full);
View Full Code Here

        RecipeContext recipeContext = new RecipeContext(recipe);
        try {
            parser.parseRecipe(recipeContext);
        } catch (Exception e) {
            if (recipeContext.isUnknownRecipe()) {
                throw new UnknownRecipeException("Not a valid file template recipe");
            }
            throw e;
        }

        DeploymentProperties bundleMetadata = recipeContext.getDeploymentProperties();
View Full Code Here

                byte[] content = StreamUtil.slurp(new FileInputStream(distributionFile));
                recipe = new String(content);
                content = null;
                recipeParseResults = parseRecipe(recipe); // if it isn't a recipe either, this will throw UnknownRecipeException
            } else {
                throw new UnknownRecipeException("Not a File Template Bundle");
            }
        } else {
            // if we parsed the recipe, then this is a distribution zip we can deal with, get the bundle file Map                
            BundleFileVisitor bundleFileVisitor = new BundleFileVisitor(recipeParseResults.getBundleMetadata()
                .getBundleName(), recipeParseResults.getBundleFileNames());
View Full Code Here

    public RecipeParseResults parseRecipe(String recipe) throws Exception {

        // all Ant recipes must use the RHQ custom ant library; if the recipe doesn't have the
        // string of that antlib URI, that means this probably isn't an Ant recipe in the first place
        if (!recipe.contains("antlib:org.rhq.bundle")) {
            throw new UnknownRecipeException("Not a valid Ant recipe");
        }

        DeploymentProperties deploymentProps;
        Set<String> bundleFiles;
        ConfigurationDefinition configDef;
View Full Code Here

        ZipUtil.walkZipFile(distributionFile, recipeVisitor);
        String recipe = recipeVisitor.getRecipe();
        RecipeParseResults recipeParseResults = recipeVisitor.getResults();

        if (null == recipeParseResults) {
            throw new UnknownRecipeException("Not an Ant Bundle");
        }

        // if we parsed the recipe then this is a distribution we can deal with, get the bundle file Map                
        BundleFileVisitor bundleFileVisitor = new BundleFileVisitor(recipeParseResults.getBundleFileNames());
        ZipUtil.walkZipFile(distributionFile, bundleFileVisitor);
View Full Code Here

TOP

Related Classes of org.rhq.enterprise.server.plugin.pc.bundle.UnknownRecipeException

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.