Package org.apache.cloudstack.storage.image.db

Examples of org.apache.cloudstack.storage.image.db.ImageDataVO


    ObjectInDataStoreManager objMap;
    @Inject
    DataStoreManager storeMgr;
    @Override
    public TemplateInfo getTemplate(long templateId, DataStore store) {
        ImageDataVO templ = imageDataDao.findById(templateId);
        if (store == null) {
            TemplateObject tmpl =  TemplateObject.getTemplate(templ, null);
            return tmpl;
        }
        ObjectInDataStoreVO obj = objMap.findObject(templateId, DataObjectType.TEMPLATE, store.getId(), store.getRole());
View Full Code Here


        Mockito.when(selector.select(Mockito.any(DataObject.class))).thenReturn(eps.get(0));
        Mockito.when(selector.select(Mockito.any(DataObject.class), Mockito.any(DataObject.class))).thenReturn(eps.get(0));
    }

  private ImageDataVO createImageData() {
    ImageDataVO image = new ImageDataVO();
    image.setTemplateType(TemplateType.USER);
    image.setUrl(this.getTemplateUrl());
    image.setUniqueName(UUID.randomUUID().toString());
    image.setName(UUID.randomUUID().toString());
    image.setPublicTemplate(true);
    image.setFeatured(true);
    image.setRequireHvm(true);
    image.setBits(64);
    image.setFormat(Storage.ImageFormat.VHD.toString());
    image.setAccountId(1);
    image.setEnablePassword(true);
    image.setEnableSshKey(true);
    image.setGuestOSId(1);
    image.setBootable(true);
    image.setPrepopulate(true);
    image.setCrossZones(true);
    image.setExtractable(true);
   
    //image.setImageDataStoreId(storeId);
    image = imageDataDao.persist(image);
   
    return image;
View Full Code Here

  }

  private TemplateInfo createTemplate() {
    try {
        DataStore store = createImageStore();
        ImageDataVO image = createImageData();
        TemplateInfo template = imageDataFactory.getTemplate(image.getId(), store);
        AsyncCallFuture<CommandResult> future = imageService.createTemplateAsync(template, store);
        future.get();
        template = imageDataFactory.getTemplate(image.getId(), store);
      /*imageProviderMgr.configure("image Provider", new HashMap<String, Object>());
      ImageDataVO image = createImageData();
      ImageDataStoreProvider defaultProvider = imageProviderMgr.getProvider("DefaultProvider");
      ImageDataStoreLifeCycle lifeCycle = defaultProvider.getLifeCycle();
      ImageDataStore store = lifeCycle.registerDataStore("defaultHttpStore", new HashMap<String, String>());
View Full Code Here

        return null;
    }

    @Override
    public String getUri() {
        ImageDataVO image = imageDao.findById(this.imageVO.getId());
        if (this.dataStore == null) {
            return image.getUrl();
        } else {
            ObjectInDataStoreVO obj = objectInStoreMgr.findObject(
                    this.imageVO.getId(), DataObjectType.TEMPLATE,
                    this.dataStore.getId(), this.dataStore.getRole());
            StringBuilder builder = new StringBuilder();
            if (obj.getState() == ObjectInDataStoreStateMachine.State.Ready
                    || obj.getState() == ObjectInDataStoreStateMachine.State.Copying) {
               
                builder.append(this.dataStore.getUri());
                builder.append("&" + EncodingType.OBJTYPE + "=" + DataObjectType.TEMPLATE);
                builder.append("&" + EncodingType.PATH + "=" + obj.getInstallPath());
                builder.append("&" + EncodingType.SIZE + "=" + image.getSize());
                return builder.toString();
            } else {
                builder.append(this.dataStore.getUri());
                builder.append("&" + EncodingType.OBJTYPE + "=" + DataObjectType.TEMPLATE);
                builder.append("&" + EncodingType.SIZE + "=" + image.getSize());
                builder.append("&" + EncodingType.PATH + "=" + image.getUrl());
                return builder.toString();
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.cloudstack.storage.image.db.ImageDataVO

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.