Examples of CrankstartException


Examples of org.apache.sling.crankstart.api.CrankstartException

    }
   
    public Object call() throws Exception {
        final String inputFilename = System.getProperty(CrankstartConstants.CRANKSTART_INPUT_FILENAME);
        if(inputFilename == null) {
            throw new CrankstartException("Missing system property " + CrankstartConstants.CRANKSTART_INPUT_FILENAME);
        }
        process(new FileReader(new File(inputFilename)));
       
        if(crankstartContext.getAttribute(CrankstartContext.ATTR_STOP_OSGI_FRAMEWORK) != null) {
            log.info("Stopping OSGi framework due to {} attribute (state={})",
View Full Code Here

Examples of org.apache.sling.crankstart.api.CrankstartException

            // If no command found fail
            if(execute(cmdLine, builtinCommands) == 0) {
                if(execute(cmdLine, extensionCommands) == 0) {
                    reloadExtensionCommands();
                    if(execute(cmdLine, extensionCommands) == 0) {
                        throw new CrankstartException(
                                "Invalid command '" + cmdLine.getVerb()
                                + "', built-in commands:" + getDescriptions(builtinCommands)
                                + ", extension commands: " + getDescriptions(extensionCommands)
                                );
                    }
View Full Code Here

Examples of org.apache.sling.crankstart.api.CrankstartException

    }

    public void execute(CrankstartContext crankstartContext, CrankstartCommandLine commandLine) throws Exception {
        final String resourceRef = commandLine.getQualifier();
        if(resourceRef == null || resourceRef.length() == 0) {
            throw new CrankstartException("Missing command qualifier, required to specifiy the resource to register");
        }
       
        @SuppressWarnings("unchecked")
        List<String> resources = (List<String>)crankstartContext.getAttribute(InstallerRegisterCommand.CONTEXT_ATTRIBUTE_NAME);
        if(resources == null) {
View Full Code Here

Examples of org.apache.sling.crankstart.api.CrankstartException

                .invoke(configAdminService, filter);
        Object result = null;
        if(c!=null && c.length > 0) {
            if(c.length > 1) {
                // Shouldn't have more than one of those configs
                throw new CrankstartException("Found " + c.length + " configs with " + CRANKSTART_CONFIG_ID + "=" + id);
            }
            result = c[0];
        }
        return result;
    }
View Full Code Here

Examples of org.apache.sling.crankstart.api.CrankstartException

                return ConfigurationHandler.read(is);
            } finally {
                is.close();
            }
        } catch(IOException ioe) {
            throw new CrankstartException("Parsing error (Felix format config) for\n" + sb, ioe);
        }
    }
View Full Code Here

Examples of org.apache.sling.crankstart.api.CrankstartException

        if(toRegister.isEmpty()) {
            log.warn("No prepared resources found to register, use {} first", InstallerRegisterCommand.I_INSTALLER_REGISTER);
        } else {
            final String prefix = commandLine.getQualifier();
            if(prefix == null || prefix.length() == 0) {
                throw new CrankstartException("Missing command qualifier, required to specify installer resources prefix");
            }
            final BundleContext ctx = crankstartContext.getOsgiFramework().getBundleContext();
            final String serviceClass = OsgiInstaller.class.getName();
            final ServiceReference ref = ctx.getServiceReference(serviceClass);
            if(ref == null) {
                throw new CrankstartException("Installer service not available, cannot register resource (" + serviceClass + ")");
            }
            final OsgiInstaller installer = (OsgiInstaller)ctx.getService(ref);
            try {
                installer.registerResources(prefix, toRegister.toArray(new InstallableResource[] {}));
                log.info("Registered {} resources with installer, using prefix '{}'", toRegister.size(), prefix);
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.