AppEngineImagesService.java :  » Google-tech » gig » org » eiichiro » gig » appengine » Java Open Source

Java Open Source » Google tech » gig 
gig » org » eiichiro » gig » appengine » AppEngineImagesService.java
/*
 * Copyright (C) 2010 Eiichiro Uchiumi. All Rights Reserved.
 * 
 * Licensed 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.eiichiro.gig.appengine;

import java.util.HashSet;
import java.util.Set;

import org.eiichiro.jazzmaster.service.Provider;
import org.eiichiro.jazzmaster.service.Service;

import com.google.appengine.api.images.ImagesService;
import com.google.appengine.api.images.ImagesServiceFactory;

/**
 * {@code AppEngineImagesService} is a service definition of App Engine's 
 * {@code ImagesService} API.
 *
 * @author <a href="mailto:eiichiro@eiichiro.org">Eiichiro Uchiumi</a>
 */
public class AppEngineImagesService extends Service {

  /** Returns {@code ImagesService}. */
  @Override
  public Set<Class<?>> getInterfaces() {
    Set<Class<?>> interfaces = new HashSet<Class<?>>(1);
    interfaces.add(ImagesService.class);
    return interfaces;
  }
  
  /**
   * Just returns <code>null</code>.
   * Implementation class is 
   * <code>com.google.appengine.api.images.ImagesServiceImpl</code>.
   * However, this method cannot return it because it is nonpublic.
   * 
   * @see org.eiichiro.jazzmaster.service.Service#getImplementation()
   */
  @Override
  public Class<?> getImplementation() {
    return null;
  }

  /** Returns {@code Provider} for {@code ImagesService}. */
  @Override
  @SuppressWarnings("unchecked")
  public Provider<ImagesService> getProvider() {
    return new Provider<ImagesService>() {

      @Override
      public ImagesService get() {
        ImagesService imagesService 
            = ImagesServiceFactory.getImagesService();
        return imagesService;
      }
      
    };
  }
  
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.