Package org.nimbustools.api._repr

Examples of org.nimbustools.api._repr._CustomizationRequest


        final String dn = principal.getDn();
        if (dn == null || dn.length() == 0) {
            throw new RemoteException("Could not obtain a valid DN");
        }

        final _Caller caller = this.repr._newCaller();
        caller.setIdentity(dn);
        return caller;
    }
View Full Code Here


        final String callerDN = SecurityManager.getManager().getCaller();
        if (callerDN == null) {
            throw new RemoteException("Cannot determine caller");
        }
       
        final _Caller caller = this.repr._newCaller();
        caller.setIdentity(callerDN);
        return caller;
    }
View Full Code Here

        if (creatorID == null) {
            return null;
        }

        final _Caller creator = this.repr._newCaller();
        creator.setIdentity(creatorID);
        return creator;
    }
View Full Code Here

        logger.info("Withdrawing previous backfill configuration from the scheduler");
        if (this.persistenceAdapter == null
                || this.manager == null || this.reprFactory == null) {
            throw new IllegalStateException("Programmer error.");
        }
        _Caller superuser = this.reprFactory._newCaller();
        superuser.setIdentity(this.getRepoUser());
        superuser.setSuperUser(true);
        RequestInfo[] bfRequests = this.manager.getBackfillRequestsByCaller(superuser);

        if (bfRequests == null || bfRequests.length == 0) {
            logger.info("No previous backfill requests were registered");
            return;
View Full Code Here

            }
        } else {
            numInstances = this.getMaxInstances();
        }

        _Caller superuser = this.reprFactory._newCaller();
        superuser.setIdentity(this.getRepoUser());
        superuser.setSuperUser(true);

        final URI imageURI;
        try {
            String imageURL =
                    this.imageLocator.getImageLocation(this.getRepoUser(), this.getDiskImage()) + "/" + this.getDiskImage();
View Full Code Here

    public Caller getCaller() {
        return getCaller("TEST_RUNNER");
    }
   
    public Caller getCaller(String id) {
        final _Caller caller = this.repr._newCaller();
        caller.setIdentity(id);
        return caller;
    }   
View Full Code Here

        return caller;
    }   

    public Caller getSuperuserCaller() {
        // workspace-service is currently broken with superuser
        _Caller superuser = this.repr._newCaller();
        superuser.setIdentity("SUPERUSER");       
        superuser.setSuperUser(true);
        return superuser;
    }
View Full Code Here

       
        if (wsreq == null) {
            throw new CannotTranslateException("wsreq may not be null");
        }

        final _CreateRequest req = this.repr._newCreateRequest();
        final VirtualWorkspace_Type vw = wsreq.getMetadata();
       
        final URI name = vw.getName();
        if (name != null) {
            req.setName(name.toString());
        }

        // -------------------------------------------------------------
        // Weed out the needed items:
        // -------------------------------------------------------------

        final Definition def = vw.getDefinition();
        if (def == null) {
            throw new CannotTranslateException(
                    "create request definition may not be missing");
        }

        final VirtualNetwork_Type net;
       
        final Logistics log = vw.getLogistics();
        if (log == null) {
            net = null;
        } else {
            net = log.getNetworking();
        }

        final CustomizeTask_Type[] customizes;

        final OptionalParameters_Type optional = wsreq.getOptionalParameters();
        if (optional != null) {
            customizes = optional.getFilewrite();
            req.setMdUserData(optional.getMdServerUserdata());
            req.setCredential(optional.getCredentialToCopy());
        } else {
            customizes = null;
        }

        // Boolean object can be null for conversion like this (null==false)
        final boolean ensDone =
                Boolean.TRUE.equals(wsreq.getEnsembleDone());
        final boolean partOfEnsemble =
                Boolean.TRUE.equals(wsreq.getPartOfEnsemble());
        final EndpointReferenceType ensembleEPR = wsreq.getEnsembleEPR();

        // it'd be interesting to not require this and use all defaults but
        // it is currently required:
        final WorkspaceDeployment_Type dep = wsreq.getResourceRequest();
        if (dep == null) {
            throw new CannotTranslateException(
                    "create request deployment may not be missing");
        }

        final PostShutdown_Type post = dep.getPostShutdown();

        // -------------------------------------------------------------
        // Translate:
        // -------------------------------------------------------------

        this.trdef.translateDefinitionRelated(req, def, post);
        this.trra.translateResourceRelated(req, dep);
        if (net != null) {
            this.trnet.translateNetworkingRelated(req, net);
        }

        if (customizes != null && customizes.length > 0) {
            final CustomizationRequest[] crs =
                    new CustomizationRequest[customizes.length];
            for (int i = 0; i < customizes.length; i++) {
                final _CustomizationRequest cr =
                        this.repr._newCustomizationRequest();
                cr.setContent(customizes[i].getContent());
                cr.setPathOnVM(customizes[i].getPathOnVM());
                crs[i] = cr;
            }
            req.setCustomizationRequests(crs);
        }

        req.setCoScheduleMember(partOfEnsemble);
        req.setCoScheduleDone(ensDone);
        if (ensembleEPR != null) {
            try {
                req.setCoScheduleID(EnsembleUtil.getResourceID(ensembleEPR));
            } catch (Exception e) {
                throw new CannotTranslateException(e.getMessage(), e);
            }
        }
       
View Full Code Here

                   ContextBrokerException {
       
        // ------------------------------------------
        // translate WS inputs into plain vws objects
        // ------------------------------------------
        _CreateRequest cReq = this.translate.getCreateRequest(req);
        final Caller caller = this.translate.getCaller(callerDN);

        // --------------------------------------
        // handle context broker related requests
        // --------------------------------------
View Full Code Here

        if (req.getPlacement() != null) {
            availabilityZone = req.getPlacement().getAvailabilityZone();
        }


        final _CreateRequest creq = this.repr._newCreateRequest();

        DefaultKernel kernel = null;
        String kernelRequestString = req.getKernelId();
        if (kernelRequestString != null) {
            kernel = new DefaultKernel();
            try {
                URI kernelURI = new URI("file://" + kernelRequestString);
                kernel.setKernel(kernelURI);
            } catch(URISyntaxException ueie) {
                throw new RemoteException(ueie.toString());
            }
        }

        creq.setContext(null);
        creq.setCoScheduleDone(false);
        creq.setCoScheduleID(null);
        creq.setCoScheduleMember(false);
        creq.setCustomizationRequests(custRequests);
        creq.setInitialStateRequest(State.STATE_Running);
        creq.setName(imageID);
        creq.setRequestedKernel(kernel); // todo
        creq.setRequestedNics(nics);
        creq.setRequestedRA(ra);
        creq.setRequestedSchedule(null); // ask for default
        creq.setRequiredVMM(reqVMM);
        creq.setShutdownType(CreateRequest.SHUTDOWN_TYPE_TRASH);
        creq.setVMFiles(files);
        creq.setMdUserData(userData);
        creq.setSshKeyName(keyname);
        creq.setClientToken(clientToken);
        creq.setRequestedResourcePool(availabilityZone);

        return creq;
    }
View Full Code Here

TOP

Related Classes of org.nimbustools.api._repr._CustomizationRequest

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.