當前位置: 首頁>>代碼示例>>Java>>正文


Java ResourceTable.addResource方法代碼示例

本文整理匯總了Java中org.commcare.resources.model.ResourceTable.addResource方法的典型用法代碼示例。如果您正苦於以下問題:Java ResourceTable.addResource方法的具體用法?Java ResourceTable.addResource怎麽用?Java ResourceTable.addResource使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.commcare.resources.model.ResourceTable的用法示例。


在下文中一共展示了ResourceTable.addResource方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: loadProfileIntoTable

import org.commcare.resources.model.ResourceTable; //導入方法依賴的package包/類
protected void loadProfileIntoTable(ResourceTable table,
                                    String profileRef,
                                    int authority)
        throws UnfullfilledRequirementsException,
        UnresolvedResourceException,
        InstallCancelledException {
    Vector<ResourceLocation> locations = new Vector<ResourceLocation>();
    locations.addElement(new ResourceLocation(authority, profileRef));

    Resource r = new Resource(Resource.RESOURCE_VERSION_UNKNOWN,
            CommCarePlatform.APP_PROFILE_RESOURCE_ID, locations,
            "Application Descriptor");

    table.addResource(r,
            table.getInstallers().getProfileInstaller(false),
            null);

    prepareProfileResource(table);
}
 
開發者ID:dimagi,項目名稱:commcare-j2me,代碼行數:20,代碼來源:ResourceManager.java

示例2: loadProfileIntoTable

import org.commcare.resources.model.ResourceTable; //導入方法依賴的package包/類
protected void loadProfileIntoTable(ResourceTable table,
                                    String profileRef,
                                    int authority)
        throws UnfullfilledRequirementsException,
        UnresolvedResourceException,
        InstallCancelledException {
    Vector<ResourceLocation> locations = new Vector<>();
    locations.addElement(new ResourceLocation(authority, profileRef));

    Resource r = new Resource(Resource.RESOURCE_VERSION_UNKNOWN,
            CommCarePlatform.APP_PROFILE_RESOURCE_ID, locations,
            "Application Descriptor");

    table.addResource(r,
            table.getInstallers().getProfileInstaller(false),
            null);

    prepareProfileResource(table);
}
 
開發者ID:dimagi,項目名稱:commcare-core,代碼行數:20,代碼來源:ResourceManager.java

示例3: installAppResources

import org.commcare.resources.model.ResourceTable; //導入方法依賴的package包/類
/**
 * Installs resources described by profile reference into the provided
 * resource table. If the resource table is ready or already has a profile,
 * don't do anything.
 *
 * @param profileReference URL to profile file
 * @param global           Add profile ref to this table and install its
 *                         resources
 * @param forceInstall     Should installation be performed regardless of
 *                         version numbers?
 */
public static void installAppResources(CommCarePlatform platform, String profileReference,
                                       ResourceTable global, boolean forceInstall)
        throws UnfullfilledRequirementsException,
        UnresolvedResourceException,
        InstallCancelledException {
    synchronized (updateLock) {
        try {
            if (!global.isReady()) {
                global.prepareResources(null, platform);
            }

            // First, see if the appropriate profile exists
            Resource profile =
                    global.getResourceWithId(CommCarePlatform.APP_PROFILE_RESOURCE_ID);

            if (profile == null) {
                // grab the local profile and parse it
                Vector<ResourceLocation> locations = new Vector<ResourceLocation>();
                locations.addElement(new ResourceLocation(Resource.RESOURCE_AUTHORITY_LOCAL, profileReference));

                // We need a way to identify this version...
                Resource r = new Resource(Resource.RESOURCE_VERSION_UNKNOWN,
                        CommCarePlatform.APP_PROFILE_RESOURCE_ID,
                        locations, "Application Descriptor");

                global.addResource(r, global.getInstallers().getProfileInstaller(forceInstall), "");
                global.prepareResources(null, platform);
            }
        } catch (StorageFullException e) {
            e.printStackTrace();
        }
    }
}
 
開發者ID:dimagi,項目名稱:commcare-j2me,代碼行數:45,代碼來源:ResourceManager.java

示例4: installAppResources

import org.commcare.resources.model.ResourceTable; //導入方法依賴的package包/類
/**
 * Installs resources described by profile reference into the provided
 * resource table. If the resource table is ready or already has a profile,
 * don't do anything.
 *
 * @param profileReference URL to profile file
 * @param global           Add profile ref to this table and install its
 *                         resources
 * @param forceInstall     Should installation be performed regardless of
 *                         version numbers?
 */
public static void installAppResources(CommCarePlatform platform, String profileReference,
                                       ResourceTable global, boolean forceInstall,
                                       int authorityForProfile)
        throws UnfullfilledRequirementsException,
        UnresolvedResourceException,
        InstallCancelledException {
    synchronized (platform) {
        if (!global.isReady()) {
            global.prepareResources(null, platform);
        }

        // First, see if the appropriate profile exists
        Resource profile =
                global.getResourceWithId(CommCarePlatform.APP_PROFILE_RESOURCE_ID);

        if (profile == null) {
            // Create a stub for the profile resource that points to the authority and location
            // from which we will install it
            Vector<ResourceLocation> locations = new Vector<>();
            locations.addElement(new ResourceLocation(authorityForProfile, profileReference));
            Resource r = new Resource(Resource.RESOURCE_VERSION_UNKNOWN,
                    CommCarePlatform.APP_PROFILE_RESOURCE_ID,
                    locations, "Application Descriptor");

            global.addResource(r, global.getInstallers().getProfileInstaller(forceInstall), "");
            global.prepareResources(null, platform);
        }
    }
}
 
開發者ID:dimagi,項目名稱:commcare-core,代碼行數:41,代碼來源:ResourceManager.java


注:本文中的org.commcare.resources.model.ResourceTable.addResource方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。