Updated Branches: refs/heads/javelin 7397716fc -> 37c95dd11
add more files Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/37c95dd1 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/37c95dd1 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/37c95dd1 Branch: refs/heads/javelin Commit: 37c95dd11a8e34522eb378c28a4c486186d7cd4f Parents: 7397716 Author: Edison Su <[email protected]> Authored: Thu Nov 1 17:20:51 2012 -0700 Committer: Edison Su <[email protected]> Committed: Thu Nov 1 17:21:15 2012 -0700 ---------------------------------------------------------------------- .../NfsDataStoreConfigurator.java | 65 ------------- .../NfsSecondaryStorageConfigurator.java | 55 ----------- .../XenNfsDataStoreConfigurator.java | 38 -------- .../cloudstack/storage/image/ImageServiceImpl.java | 71 +++++++++++++++ .../apache/cloudstack/storage/image/Template.java | 31 +++++++ .../storage/image/driver/ImageDataStoreDriver.java | 28 ++++++ .../image/driver/ImageDataStoreDriverImpl.java | 51 +++++++++++ .../image/manager/ImageDataStoreManager.java | 25 +++++ .../image/manager/ImageDataStoreManagerImpl.java | 31 +++++++ .../storage/image/store/ImageDataStore.java | 7 ++- .../storage/image/store/ImageDataStoreImpl.java | 49 ++++++++++ 11 files changed, 292 insertions(+), 159 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/37c95dd1/platform/storage/src/org/apache/cloudstack/storage/datastoreconfigurator/NfsDataStoreConfigurator.java ---------------------------------------------------------------------- diff --git a/platform/storage/src/org/apache/cloudstack/storage/datastoreconfigurator/NfsDataStoreConfigurator.java b/platform/storage/src/org/apache/cloudstack/storage/datastoreconfigurator/NfsDataStoreConfigurator.java deleted file mode 100644 index 6a01834..0000000 --- a/platform/storage/src/org/apache/cloudstack/storage/datastoreconfigurator/NfsDataStoreConfigurator.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.apache.cloudstack.storage.datastoreconfigurator; - -import java.net.URI; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import org.apache.cloudstack.platform.subsystem.api.storage.DataStore; -import org.apache.cloudstack.platform.subsystem.api.storage.DataStoreConfigurator; - -import com.cloud.exception.InvalidParameterValueException; -import com.cloud.storage.StoragePool; -import com.cloud.storage.StoragePoolVO; -import com.cloud.storage.Storage.StoragePoolType; - -public abstract class NfsDataStoreConfigurator implements DataStoreConfigurator { - private enum NfsConfigName { - SERVER, - PORT, - PATH; - } - - public NfsDataStoreConfigurator() { - - } - - public String getProtocol() { - return "NFS"; - } - - public Map<String, String> getConfigs(URI uri, Map<String, String> extras) { - Map<String, String> configs = new HashMap<String, String>(); - String storageHost = uri.getHost(); - String hostPath = uri.getPath(); - configs.put(NfsConfigName.SERVER.toString(), storageHost); - configs.put(NfsConfigName.PATH.toString(), hostPath); - configs.putAll(extras); - - return configs; - } - - public List<String> getConfigNames() { - List<String> names = new ArrayList<String>(); - names.add(NfsConfigName.SERVER.toString()); - names.add(NfsConfigName.PATH.toString()); - return names; - } - - public boolean validate(Map<String, String> configs) { - String uriHost = configs.get(NfsConfigName.SERVER.toString()); - String uriPath = configs.get(NfsConfigName.PATH.toString()); - if (uriHost == null || uriPath == null || uriHost.trim().isEmpty() || uriPath.trim().isEmpty()) { - throw new InvalidParameterValueException("host or path is null, should be nfs://hostname/path"); - } - return true; - } - - public DataStore getDataStore(StoragePool pool) { - // TODO Auto-generated method stub - return null; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/37c95dd1/platform/storage/src/org/apache/cloudstack/storage/datastoreconfigurator/NfsSecondaryStorageConfigurator.java ---------------------------------------------------------------------- diff --git a/platform/storage/src/org/apache/cloudstack/storage/datastoreconfigurator/NfsSecondaryStorageConfigurator.java b/platform/storage/src/org/apache/cloudstack/storage/datastoreconfigurator/NfsSecondaryStorageConfigurator.java deleted file mode 100644 index a69b6a6..0000000 --- a/platform/storage/src/org/apache/cloudstack/storage/datastoreconfigurator/NfsSecondaryStorageConfigurator.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.cloudstack.storage.datastoreconfigurator; - -import java.util.Map; - -import org.apache.cloudstack.platform.subsystem.api.storage.DataStore; -import org.apache.cloudstack.platform.subsystem.api.storage.DataStore.StoreType; -import org.apache.cloudstack.storage.datastore.DefaultDataStore; -import org.apache.cloudstack.storage.driver.DefaultNfsSecondaryDriver; -import org.apache.cloudstack.storage.epselector.DefaultNfsSecondaryEndPointSelector; - -import org.apache.cloudstack.storage.lifecycle.DefaultNfsSecondaryLifeCycle; - -import org.apache.cloudstack.storage.strategy.DefaultTemplateStratey; - - -import com.cloud.storage.StoragePool; - -public class NfsSecondaryStorageConfigurator extends NfsDataStoreConfigurator { - @Override - public DataStore getDataStore(StoragePool pool) { - DefaultDataStore ds = new DefaultDataStore(); - ds.setEndPointSelector(new DefaultNfsSecondaryEndPointSelector(ds)); - ds.setId(pool.getId()); - ds.setType(StoreType.Image); - ds.setURI(pool.getHostAddress() + "/" + pool.getPath()); - ds.setUUID(pool.getUuid()); - ds.setDataStoreDriver(new DefaultNfsSecondaryDriver(ds)); - ds.setTemplateStrategy(new DefaultTemplateStratey(ds)); - ds.setLifeCycle(new DefaultNfsSecondaryLifeCycle(ds)); - return ds; - } - public StoragePool getStoragePool(Map<String, String> configs) { - // TODO Auto-generated method stub - return null; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/37c95dd1/platform/storage/src/org/apache/cloudstack/storage/datastoreconfigurator/XenNfsDataStoreConfigurator.java ---------------------------------------------------------------------- diff --git a/platform/storage/src/org/apache/cloudstack/storage/datastoreconfigurator/XenNfsDataStoreConfigurator.java b/platform/storage/src/org/apache/cloudstack/storage/datastoreconfigurator/XenNfsDataStoreConfigurator.java deleted file mode 100644 index 883f01c..0000000 --- a/platform/storage/src/org/apache/cloudstack/storage/datastoreconfigurator/XenNfsDataStoreConfigurator.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.apache.cloudstack.storage.datastoreconfigurator; - -import java.util.Map; - -import org.apache.cloudstack.platform.subsystem.api.storage.DataStore; -import org.apache.cloudstack.platform.subsystem.api.storage.DataStore.StoreType; -import org.apache.cloudstack.storage.datastore.DefaultDataStore; -import org.apache.cloudstack.storage.driver.XenServerStorageDriver; -import org.apache.cloudstack.storage.epselector.DefaultPrimaryEndpointSelector; -import org.apache.cloudstack.storage.lifecycle.DefaultPrimaryDataStoreLifeCycle; -import org.apache.cloudstack.storage.strategy.XenBackupStrategy; -import org.apache.cloudstack.storage.strategy.XenSnapshotStrategy; -import org.apache.cloudstack.storage.strategy.DefaultVolumeStrategy; - -import com.cloud.storage.StoragePool; - -public class XenNfsDataStoreConfigurator extends NfsDataStoreConfigurator { - @Override - public DataStore getDataStore(StoragePool pool) { - DefaultDataStore ds = new DefaultDataStore(); - ds.setEndPointSelector(new DefaultPrimaryEndpointSelector(ds)); - ds.setId(pool.getId()); - ds.setType(StoreType.Primary); - ds.setURI(pool.getHostAddress() + "/" + pool.getPath()); - ds.setUUID(pool.getUuid()); - ds.setDataStoreDriver(new XenServerStorageDriver(ds)); - ds.setBackupStrategy(new XenBackupStrategy(ds)); - ds.setVolumeStrategy(new DefaultVolumeStrategy(ds)); - ds.setSnapshotStrategy(new XenSnapshotStrategy(ds)); - ds.setLifeCycle(new DefaultPrimaryDataStoreLifeCycle(ds)); - return ds; - } - - public StoragePool getStoragePool(Map<String, String> configs) { - // TODO Auto-generated method stub - return null; - } -} http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/37c95dd1/platform/storage/src/org/apache/cloudstack/storage/image/ImageServiceImpl.java ---------------------------------------------------------------------- diff --git a/platform/storage/src/org/apache/cloudstack/storage/image/ImageServiceImpl.java b/platform/storage/src/org/apache/cloudstack/storage/image/ImageServiceImpl.java new file mode 100644 index 0000000..119a255 --- /dev/null +++ b/platform/storage/src/org/apache/cloudstack/storage/image/ImageServiceImpl.java @@ -0,0 +1,71 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cloudstack.storage.image; + +public class ImageServiceImpl implements ImageService { + + @Override + public long registerTemplate(String templateUrl, long accountId) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public boolean deleteTemplate(long templateId) { + // TODO Auto-generated method stub + return false; + } + + @Override + public long registerIso(String isoUrl, long accountId) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public boolean deleteIso(long isoId) { + // TODO Auto-generated method stub + return false; + } + + @Override + public String grantTemplateAccess(long templateId, long endpointId) { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean revokeTemplateAccess(long templateId, long endpointId) { + // TODO Auto-generated method stub + return false; + } + + @Override + public String grantIsoAccess(long isoId, long endpointId) { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean revokeIsoAccess(long isoId, long endpointId) { + // TODO Auto-generated method stub + return false; + } + +} http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/37c95dd1/platform/storage/src/org/apache/cloudstack/storage/image/Template.java ---------------------------------------------------------------------- diff --git a/platform/storage/src/org/apache/cloudstack/storage/image/Template.java b/platform/storage/src/org/apache/cloudstack/storage/image/Template.java new file mode 100644 index 0000000..8191550 --- /dev/null +++ b/platform/storage/src/org/apache/cloudstack/storage/image/Template.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cloudstack.storage.image; + +import org.apache.cloudstack.storage.image.db.ImageDataVO; +import org.apache.cloudstack.storage.image.store.ImageDataStore; + +public class Template { + protected ImageDataVO imageVO; + protected ImageDataStore dataStore; + public Template(ImageDataStore dataStore, ImageDataVO imageVO) { + this.dataStore = dataStore; + this.imageVO = imageVO; + } +} http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/37c95dd1/platform/storage/src/org/apache/cloudstack/storage/image/driver/ImageDataStoreDriver.java ---------------------------------------------------------------------- diff --git a/platform/storage/src/org/apache/cloudstack/storage/image/driver/ImageDataStoreDriver.java b/platform/storage/src/org/apache/cloudstack/storage/image/driver/ImageDataStoreDriver.java new file mode 100644 index 0000000..1a45bd9 --- /dev/null +++ b/platform/storage/src/org/apache/cloudstack/storage/image/driver/ImageDataStoreDriver.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cloudstack.storage.image.driver; + +import org.apache.cloudstack.storage.image.Template; + +public interface ImageDataStoreDriver { + boolean registerTemplate(Template template); + String grantAccess(long templateId, long endPointId); + boolean revokeAccess(long templateId, long endPointId); + boolean deleteTemplate(Template template); +} http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/37c95dd1/platform/storage/src/org/apache/cloudstack/storage/image/driver/ImageDataStoreDriverImpl.java ---------------------------------------------------------------------- diff --git a/platform/storage/src/org/apache/cloudstack/storage/image/driver/ImageDataStoreDriverImpl.java b/platform/storage/src/org/apache/cloudstack/storage/image/driver/ImageDataStoreDriverImpl.java new file mode 100644 index 0000000..55a8920 --- /dev/null +++ b/platform/storage/src/org/apache/cloudstack/storage/image/driver/ImageDataStoreDriverImpl.java @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cloudstack.storage.image.driver; + +import org.apache.cloudstack.storage.image.Template; + +public class ImageDataStoreDriverImpl implements ImageDataStoreDriver { + + @Override + public boolean registerTemplate(Template template) { + // TODO Auto-generated method stub + return false; + } + + @Override + public String grantAccess(long templateId, long endPointId) { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean revokeAccess(long templateId, long endPointId) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean deleteTemplate(Template template) { + // TODO Auto-generated method stub + return false; + } + + + +} http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/37c95dd1/platform/storage/src/org/apache/cloudstack/storage/image/manager/ImageDataStoreManager.java ---------------------------------------------------------------------- diff --git a/platform/storage/src/org/apache/cloudstack/storage/image/manager/ImageDataStoreManager.java b/platform/storage/src/org/apache/cloudstack/storage/image/manager/ImageDataStoreManager.java new file mode 100644 index 0000000..878e394 --- /dev/null +++ b/platform/storage/src/org/apache/cloudstack/storage/image/manager/ImageDataStoreManager.java @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cloudstack.storage.image.manager; + +import org.apache.cloudstack.storage.image.store.ImageDataStore; + +public interface ImageDataStoreManager { + ImageDataStore getImageDataStore(long dataStoreId); +} http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/37c95dd1/platform/storage/src/org/apache/cloudstack/storage/image/manager/ImageDataStoreManagerImpl.java ---------------------------------------------------------------------- diff --git a/platform/storage/src/org/apache/cloudstack/storage/image/manager/ImageDataStoreManagerImpl.java b/platform/storage/src/org/apache/cloudstack/storage/image/manager/ImageDataStoreManagerImpl.java new file mode 100644 index 0000000..6f8a58f --- /dev/null +++ b/platform/storage/src/org/apache/cloudstack/storage/image/manager/ImageDataStoreManagerImpl.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cloudstack.storage.image.manager; + +import org.apache.cloudstack.storage.image.store.ImageDataStore; + +public class ImageDataStoreManagerImpl implements ImageDataStoreManager { + + @Override + public ImageDataStore getImageDataStore(long dataStoreId) { + // TODO Auto-generated method stub + return null; + } + +} http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/37c95dd1/platform/storage/src/org/apache/cloudstack/storage/image/store/ImageDataStore.java ---------------------------------------------------------------------- diff --git a/platform/storage/src/org/apache/cloudstack/storage/image/store/ImageDataStore.java b/platform/storage/src/org/apache/cloudstack/storage/image/store/ImageDataStore.java index db7c265..2faead9 100644 --- a/platform/storage/src/org/apache/cloudstack/storage/image/store/ImageDataStore.java +++ b/platform/storage/src/org/apache/cloudstack/storage/image/store/ImageDataStore.java @@ -18,6 +18,11 @@ */ package org.apache.cloudstack.storage.image.store; +import org.apache.cloudstack.storage.image.Template; + public interface ImageDataStore { - + Template registerTemplate(long templateId); + String grantAccess(long templateId, long endPointId); + boolean revokeAccess(long templateId, long endPointId); + boolean deleteTemplate(long templateId); } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/37c95dd1/platform/storage/src/org/apache/cloudstack/storage/image/store/ImageDataStoreImpl.java ---------------------------------------------------------------------- diff --git a/platform/storage/src/org/apache/cloudstack/storage/image/store/ImageDataStoreImpl.java b/platform/storage/src/org/apache/cloudstack/storage/image/store/ImageDataStoreImpl.java new file mode 100644 index 0000000..5986378 --- /dev/null +++ b/platform/storage/src/org/apache/cloudstack/storage/image/store/ImageDataStoreImpl.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cloudstack.storage.image.store; + +import org.apache.cloudstack.storage.image.Template; + +public class ImageDataStoreImpl implements ImageDataStore { + + @Override + public Template registerTemplate(long templateId) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String grantAccess(long templateId, long endPointId) { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean revokeAccess(long templateId, long endPointId) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean deleteTemplate(long templateId) { + // TODO Auto-generated method stub + return false; + } + +}
