本文整理汇总了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);
}
示例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);
}
示例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();
}
}
}
示例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);
}
}
}