Android Open Source - loopback-sdk-android Container






From Project

Back to project page loopback-sdk-android.

License

The source code is released under:

MIT License

If you think the Android project loopback-sdk-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.strongloop.android.loopback;
/*from w w w  .  jav  a  2 s .  c  om*/
import com.google.common.collect.ImmutableMap;
import com.strongloop.android.loopback.callbacks.ListCallback;
import com.strongloop.android.loopback.callbacks.ObjectCallback;
import com.strongloop.android.remoting.VirtualObject;


public class Container extends VirtualObject {

    private String name;
    public void setName(String name) {
        this.name = name;
    }
    public String getName() {
        return name;
    }

    /**
     * Upload a new file
     * @param file Content of the file.
     * @param callback The callback to be executed when finished.
     */
    public void upload(java.io.File file, ObjectCallback<File> callback) {
        getFileRepository().upload(file, callback);
    }

    /**
     * Upload a new file
     * @param fileName The file name, must be unique within the container.
     * @param content Content of the file.
     * @param contentType Content type (optional).
     * @param callback The callback to be executed when finished.
     */
    public void upload(String fileName, byte[] content, String contentType,
                       ObjectCallback<File> callback) {
        getFileRepository().upload(fileName, content, contentType, callback);
    }

    /**
     * Create a new File object associated with this container.
     * @param name The name of the file.
     * @return the object created
     */
    public File createFileObject(String name) {
        return getFileRepository().createObject(ImmutableMap.of("name", name));
    }

    /**
     * Get data of a File object.
     * @param fileName The name of the file.
     * @param callback The callback to be executed when finished.
     */
    public void getFile(String fileName, ObjectCallback<File> callback) {
        getFileRepository().get(fileName, callback);
    }

    /**
     * List all files in the container.
     * @param callback The callback to be executed when finished.
     */
    public void getAllFiles(ListCallback<File> callback) {
        getFileRepository().getAll(callback);
    }

    public FileRepository getFileRepository() {
        RestAdapter adapter = ((RestAdapter)getRepository().getAdapter());
        FileRepository repo = adapter.createRepository(FileRepository.class);
        repo.setContainer(this);
        return repo;
    }
}




Java Source Code List

com.strongloop.android.loopback.AccessTokenRepository.java
com.strongloop.android.loopback.AccessToken.java
com.strongloop.android.loopback.ContainerRepository.java
com.strongloop.android.loopback.Container.java
com.strongloop.android.loopback.FileRepository.java
com.strongloop.android.loopback.File.java
com.strongloop.android.loopback.LocalInstallation.java
com.strongloop.android.loopback.ModelRepository.java
com.strongloop.android.loopback.Model.java
com.strongloop.android.loopback.RestAdapter.java
com.strongloop.android.loopback.RestRepository.java
com.strongloop.android.loopback.UserRepository.java
com.strongloop.android.loopback.User.java
com.strongloop.android.loopback.callbacks.EmptyResponseParser.java
com.strongloop.android.loopback.callbacks.JsonArrayParser.java
com.strongloop.android.loopback.callbacks.JsonObjectParser.java
com.strongloop.android.loopback.callbacks.ListCallback.java
com.strongloop.android.loopback.callbacks.ObjectCallback.java
com.strongloop.android.loopback.callbacks.VoidCallback.java
com.strongloop.android.remoting.BeanUtil.java
com.strongloop.android.remoting.JsonUtil.java
com.strongloop.android.remoting.Repository.java
com.strongloop.android.remoting.Transient.java
com.strongloop.android.remoting.VirtualObject.java
com.strongloop.android.remoting.adapters.Adapter.java
com.strongloop.android.remoting.adapters.RestAdapter.java
com.strongloop.android.remoting.adapters.RestContractItem.java
com.strongloop.android.remoting.adapters.RestContract.java
com.strongloop.android.remoting.adapters.StreamParam.java