Examples of CreationException


Examples of javax.inject.CreationException

            Context context = SystemInstance.get().getComponent(ContainerSystem.class).getJNDIContext();

            NamingEnumeration<NameClassPair> persUnits = context.list("java:openejb/PersistenceUnit");
            if (persUnits == null)
            {
                throw new CreationException( "No PersistenceUnit found in java:openejb/PersistenceUnit!" );
            }

            String shortestMatch = null;
           
            while (persUnits.hasMore())
            {
                NameClassPair puNc = persUnits.next();
               
                if (puNc.getName().startsWith(unitName))
                {
                    if (shortestMatch == null || shortestMatch.length() > puNc.getName().length())
                    {
                        shortestMatch = puNc.getName();
                    }
                }
               
            }
           
            if (shortestMatch == null)
            {
                throw new CreationException("PersistenceUnit '" + unitName + "' not found");
            }
           
            factory = (EntityManagerFactory) context.lookup("java:openejb/PersistenceUnit/" + shortestMatch);
        } catch (NamingException e) {
            throw new CreationException("PersistenceUnit '" + unitName + "' not found", e );
        }
        return factory;
    }
View Full Code Here

Examples of javax.inject.CreationException

               
                throw rt;
            }
            else
            {
                throw new CreationException(throwable);
            }
           
        }
        finally
        {
View Full Code Here

Examples of org.elasticsearch.common.inject.CreationException

            }
        } catch (Throwable t) {
            errorMessage.append(stage).append(" Failed ...\n");
        }
        if (e instanceof CreationException) {
            CreationException createException = (CreationException) e;
            Set<String> seenMessages = newHashSet();
            int counter = 1;
            for (Message message : createException.getErrorMessages()) {
                String detailedMessage;
                if (message.getCause() == null) {
                    detailedMessage = message.getMessage();
                } else {
                    detailedMessage = ExceptionsHelper.detailedMessage(message.getCause(), true, 0);
View Full Code Here

Examples of org.elasticsearch.common.inject.CreationException

    public void throwCreationExceptionIfErrorsExist() {
        if (!hasErrors()) {
            return;
        }

        throw new CreationException(getMessages());
    }
View Full Code Here

Examples of org.nimbustools.api.services.rm.CreationException

                    vm.getName() + "', setting default";
            logger.debug(dbg);
            vm.setKernel(null);           
        } else if (!uri.getScheme().equals("file")) {
            // not supporting propagating kernels currently
            throw new CreationException("supplied, non-default kernel " +
                    "cannot currently be a remote file");
        } else {
            final String image = uri.toASCIIString();
            logger.trace("found kernel image: '" + image + "'");
            vm.setKernel(image);
View Full Code Here

Examples of org.nimbustools.api.services.rm.CreationException

    public void consume(VirtualMachine vm,
                        VMFile[] vmFiles)
            throws CreationException, ResourceRequestDeniedException {

        if (vmFiles == null || vmFiles.length == 0) {
            throw new CreationException("VM file description(s) missing");
        }

        final String vmName = vm.getName();

        boolean seenRootDisk = false;
       
        final boolean propagationEnabled = this.globals.isPropagateEnabled();
       
        final ArrayList partitions = new ArrayList(8);

        for (int i = 0; i < vmFiles.length; i++) {
           
            final VMFile file = vmFiles[i];
            if (file == null) {
                throw new CreationException(
                        "vmFile[] contents may not be null (index " + i + ")");
            }

            if (file.isRootFile()) {

                if (seenRootDisk) {
                    throw new CreationException("more than one root disk?");
                } else {
                    seenRootDisk = true;
                }

                // TODO:
View Full Code Here

Examples of org.nimbustools.api.services.rm.CreationException

        if (!propagationEnabled && !local) {
            final String err = "cannot propagate: supplied image '" +
                    uri.toASCIIString() + "' is not specified with " +
                    "file:// and propagation is disabled";
            throw new CreationException(err);
        }

        if (propagationEnabled && http) {
            boolean foundHost = false;

            String[] allowedHosts = this.globals.getAllowedHttpHosts();
            for (String allowedHost : allowedHosts) {
                //convert glob to regex
                allowedHost = allowedHost.trim();
                allowedHost = allowedHost.replaceAll("\\.", "\\\\\\.");
                allowedHost = allowedHost.replaceAll("\\*", "\\.\\*");

                if (uri.getHost().matches(allowedHost)) {
                    foundHost = true;
                }
            }

            if (!foundHost) {
                final String err = "cannot propagate: supplied image is from '" +
                    uri.getHost() + "' which is not in allowed.http.hosts";
                throw new CreationException(err);
            }
        }

        final VirtualMachinePartition partition = new VirtualMachinePartition();

View Full Code Here

Examples of org.nimbustools.api.services.rm.CreationException

        if (!uri.getScheme().equals("file")) {
            final String err = "request for '" + vmName + "' contains " +
                    "partition that is not root disk or a blank space " +
                    "creation request but it is not a cache reference " +
                    "(currently no propagate support for these)";
            throw new CreationException(err);
        }

        partition.setImage(uri.toASCIIString());
        partition.setImagemount(file.getMountAs());
        partition.setRootdisk(false);
View Full Code Here

Examples of org.nimbustools.api.services.rm.CreationException

            throws CreationException {

        if (megabytes < 1) {
            final String err = "blank space request under 1 megabyte in " +
                    "request for '" + vmName + "'";
            throw new CreationException(err);
        }

        final VirtualMachinePartition partition = new VirtualMachinePartition();
        partition.setPropRequired(false);
        partition.setUnPropRequired(false);
View Full Code Here

Examples of org.nimbustools.api.services.rm.CreationException

        final ArrayList nicnames = new ArrayList(nics.length);
        for (int i = 0; i < nics.length; i++) {
            final NIC nic = nics[i];
            final String name = nic.getName();
            if (nicnames.contains(name)) {
                throw new CreationException("You can not specify multiple " +
                        "NICs with the same name");
            }
            nicnames.add(name);
        }
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.