org.jclouds.vcloud.config.DefaultVCloudReferencesModule Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vcloud Show documentation
Show all versions of vcloud Show documentation
jclouds components to access an implementation of VMWare vCloud
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.vcloud.config;
import java.net.URI;
import java.util.Map;
import javax.annotation.Resource;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.logging.Logger;
import org.jclouds.rest.annotations.Identity;
import org.jclouds.util.Suppliers2;
import org.jclouds.vcloud.domain.Catalog;
import org.jclouds.vcloud.domain.ReferenceType;
import com.google.common.base.Function;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableMap.Builder;
import com.google.inject.AbstractModule;
import com.google.inject.Injector;
import com.google.inject.Provides;
/**
*
* @author Adrian Cole
*/
public class DefaultVCloudReferencesModule extends AbstractModule {
@Override
protected void configure() {
}
@Provides
@org.jclouds.vcloud.endpoints.Org
@Singleton
protected Supplier provideDefaultOrg(DefaultOrgForUser defaultOrgURIForUser,
@Identity String user) {
return defaultOrgURIForUser.apply(user);
}
@Provides
@Singleton
@org.jclouds.vcloud.endpoints.Org
protected Predicate provideDefaultOrgSelector(Injector i) {
return Predicates.alwaysTrue();
}
@Provides
@org.jclouds.vcloud.endpoints.TasksList
@Singleton
protected Supplier provideDefaultTasksList(DefaultTasksListForOrg defaultTasksListURIForOrg,
@org.jclouds.vcloud.endpoints.Org Supplier defaultOrg) {
return Suppliers2.compose(defaultTasksListURIForOrg, defaultOrg);
}
@Provides
@org.jclouds.vcloud.endpoints.Catalog
@Singleton
protected Supplier provideDefaultCatalog(DefaultCatalogForOrg defaultCatalogURIForOrg,
@org.jclouds.vcloud.endpoints.Org Supplier defaultOrg) {
return Suppliers2.compose(defaultCatalogURIForOrg, defaultOrg);
}
@Provides
@Singleton
@org.jclouds.vcloud.endpoints.Catalog
protected Predicate provideDefaultCatalogSelector(Injector i) {
return i.getInstance(WriteableCatalog.class);
}
@Provides
@Singleton
protected Supplier
© 2015 - 2025 Weber Informatics LLC | Privacy Policy