Java ReferenceManager类代码示例(java中org.javarosa.core.core.core.core.core.core.referenceager类的典型用法)

本文整理汇总了Java中org.javarosa.core.reference.ReferenceManager的典型用法代码示例。如果您正苦于以下问题:Java ReferenceManager类的具体用法?Java ReferenceManager怎么用?Java ReferenceManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Java ReferenceManager类代码示例(java中org.javarosa.core.core.core.core.core.core.referenceager类的典型用法)

ReferenceManager类属于org.javarosa.core.reference包,在下文中一共展示了ReferenceManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getBypassRef

import org.javarosa.core.reference.ReferenceManager; //导入依赖的package包/类
public Reference getBypassRef() {
    try {
        String bypassRef = PropertyManager._().getSingularProperty(CommCareProperties.OTA_RESTORE_OFFLINE);
        if(bypassRef == null || bypassRef == "") {
            return null;
        }

        Reference bypass = ReferenceManager._().DeriveReference(bypassRef);
        if(bypass == null || !bypass.doesBinaryExist()) {
            return null;
        }
        return bypass;
    } catch(Exception e){
        e.printStackTrace();
        //It would be absurdly stupid if we couldn't OTA restore because of an error here
        return null;
    }

} 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:20,代码来源:CommCareRestorer.java

示例2: queueError

import org.javarosa.core.reference.ReferenceManager; //导入依赖的package包/类
private void queueError(String title, String msg, String image, String audio) {
        alertTitle = title;
        this.msg = msg;

        //Try to load the image
        this.alertImage = null;
        if(image != null) {
            try {
                Reference ref = ReferenceManager._().DeriveReference(image);
                InputStream in = ref.getStream();
                this.alertImage = Image.createImage(in);
                in.close();
            } catch (IOException e) {
                Logger.exception(e);
            } catch(InvalidReferenceException ire) {
                Logger.exception(ire);
            }
        }

        //Try to load the image
        this.audioURI = audio;
} 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:23,代码来源:Chatterbox.java

示例3: registerModule

import org.javarosa.core.reference.ReferenceManager; //导入依赖的package包/类
public void registerModule() {

        //Note: Do not remove fully qualified names here, otherwise the imports mess up the polish preprocessing

        //#if polish.api.wmapi
        String[] prototypes = new String[] { SimpleHttpTransportMessage.class.getName(), org.javarosa.services.transport.impl.sms.SMSTransportMessage.class.getName(), org.javarosa.services.transport.impl.binarysms.BinarySMSTransportMessage.class.getName(), TransportMessageSerializationWrapper.class.getName(), org.javarosa.core.services.transport.payload.ByteArrayPayload.class.getName(), org.javarosa.core.services.transport.payload.DataPointerPayload.class.getName(), org.javarosa.core.services.transport.payload.MultiMessagePayload.class.getName(), org.javarosa.services.transport.impl.simplehttp.multipart.HttpTransportHeader.class.getName()};
        //#else
        //# String[] prototypes = new String[] { SimpleHttpTransportMessage.class.getName(), TransportMessageSerializationWrapper.class.getName(), org.javarosa.core.services.transport.payload.ByteArrayPayload.class.getName(), org.javarosa.core.services.transport.payload.DataPointerPayload.class.getName(), org.javarosa.core.services.transport.payload.MultiMessagePayload.class.getName(), org.javarosa.services.transport.impl.simplehttp.multipart.HttpTransportHeader.class.getName()};
        //#endif

        PrototypeManager.registerPrototypes(prototypes);

        StorageManager.registerWrappedStorage(TransportMessageStore.Q_STORENAME, TransportMessageStore.Q_STORENAME, new TransportMessageSerializationWrapper());
        StorageManager.registerWrappedStorage(TransportMessageStore.RECENTLY_SENT_STORENAME, TransportMessageStore.RECENTLY_SENT_STORENAME, new TransportMessageSerializationWrapper());
        ReferenceManager._().addReferenceFactory(new HttpRoot(listener));
        
        PropertyManager._().addRules(new TransportPropertyRules());
        
        TransportService.init();
    } 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:21,代码来源:TransportManagerModule.java

示例4: setFileSystemRootFromResourceAndReturnRelativeRef

import org.javarosa.core.reference.ReferenceManager; //导入依赖的package包/类
private String setFileSystemRootFromResourceAndReturnRelativeRef(String resource) {
    int lastSeparator = resource.lastIndexOf(File.separator);

    String rootPath;
    String filePart;

    if(lastSeparator == -1 ) {
        rootPath = new File("").getAbsolutePath();
        filePart = resource;
    } else {
        //Get the location of the file. In the future, we'll treat this as the resource root
        rootPath = resource.substring(0,resource.lastIndexOf(File.separator));

        //cut off the end
        filePart = resource.substring(resource.lastIndexOf(File.separator) + 1);
    }

    //(That root now reads as jr://file/)
    ReferenceManager._().addReferenceFactory(new JavaFileRoot(rootPath));

    //Now build the testing reference we'll use
    return "jr://file/" + filePart;
} 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:24,代码来源:CommCareConfigEngine.java

示例5: addDerivedLocation

import org.javarosa.core.reference.ReferenceManager; //导入依赖的package包/类
/**
 * Derive a reference from the given location and context; adding it to the
 * vector of references.
 *
 * @param location Contains a reference to a resource.
 * @param context  Provides context for any relative reference accessors.
 *                 Can be null.
 * @param ret      Add derived reference of location to this Vector.
 */
private static void addDerivedLocation(ResourceLocation location,
                                       Reference context,
                                       Vector<Reference> ret) {
    try {
        final Reference derivedRef;
        if (context == null) {
            derivedRef =
                    ReferenceManager._().DeriveReference(location.getLocation());
        } else {
            // contextualize the location ref in terms of the multiple refs
            // pointing to different locations for the parent resource
            derivedRef =
                    ReferenceManager._().DeriveReference(location.getLocation(),
                            context);
        }
        ret.addElement(derivedRef);
    } catch (InvalidReferenceException e) {
        e.printStackTrace();
    }
} 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:30,代码来源:ResourceTable.java

示例6: getAudioFilename

import org.javarosa.core.reference.ReferenceManager; //导入依赖的package包/类
/**
 * Gets the audio source filename from the URI.
 *
 * @return Filepath of audio source stored in local URI. Returns an empty
 * string if no audio source is found.
 */
private String getAudioFilename(String URI) throws IOException {
    if (URI == null) {
        throw new IOException("No audio file was specified");
    }

    String audioFilename;
    try {
        audioFilename =
                ReferenceManager.instance().DeriveReference(URI).getLocalURI();
    } catch (InvalidReferenceException e) {
        throw new IOException(e);
    }

    File audioFile = new File(audioFilename);
    if (!audioFile.exists()) {
        throw new IOException("File missing: " + audioFilename);
    }
    return audioFilename;
} 
开发者ID:dimagi,项目名称:commcare-android,代码行数:26,代码来源:MediaEntity.java

示例7: setReadyToInstall

import org.javarosa.core.reference.ReferenceManager; //导入依赖的package包/类
private void setReadyToInstall(String reference) {
    incomingRef = reference;
    this.uiState = UiState.READY_TO_INSTALL;

    try {
        ReferenceManager.instance().DeriveReference(incomingRef);
        if (lastInstallMode == INSTALL_MODE_OFFLINE || lastInstallMode == INSTALL_MODE_FROM_LIST) {
            onStartInstallClicked();
        } else {
            uiStateScreenTransition();
        }
    } catch (InvalidReferenceException ire) {
        incomingRef = null;
        fail(Localization.get("install.bad.ref"));
    }
} 
开发者ID:dimagi,项目名称:commcare-android,代码行数:17,代码来源:CommCareSetupActivity.java

示例8: performLocalRestore

import org.javarosa.core.reference.ReferenceManager; //导入依赖的package包/类
public <I extends CommCareActivity & PullTaskResultReceiver> void performLocalRestore(
        I context,
        String username,
        String password) {

    try {
        ReferenceManager.instance().DeriveReference(
                SingleAppInstallation.LOCAL_RESTORE_REFERENCE).getStream();
    } catch (InvalidReferenceException | IOException e) {
        throw new RuntimeException("Local restore file missing");
    }

    LocalReferencePullResponseFactory.setRequestPayloads(new String[]{SingleAppInstallation.LOCAL_RESTORE_REFERENCE});
    syncData(context, false, false, "fake-server-that-is-never-used", username, password, "unused",
            LocalReferencePullResponseFactory.INSTANCE, true);
} 
开发者ID:dimagi,项目名称:commcare-android,代码行数:17,代码来源:FormAndDataSyncer.java

示例9: onItemLongClick

import org.javarosa.core.reference.ReferenceManager; //导入依赖的package包/类
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view,
        int position, long id) {
    MenuDisplayable value = (MenuDisplayable)parent.getAdapter().getItem(position);
    String audioURI = value.getAudioURI();
    MediaPlayer mp = new MediaPlayer();
    String audioFilename;
    if (audioURI != null && !audioURI.equals("")) {
        try {
            audioFilename = ReferenceManager.instance().DeriveReference(audioURI).getLocalURI();
            mp.setDataSource(audioFilename);
            mp.prepare();
            mp.start();
        } catch (IOException | IllegalStateException
                | InvalidReferenceException e) {
            e.printStackTrace();
        }
    }
    return false;
} 
开发者ID:dimagi,项目名称:commcare-android,代码行数:21,代码来源:MenuGrid.java

示例10: initializeFileRoots

import org.javarosa.core.reference.ReferenceManager; //导入依赖的package包/类
private void initializeFileRoots() {
    synchronized (lock) {
        String root = storageRoot();
        fileRoot = new JavaFileRoot(root);

        String testFileRoot = "jr://file/mytest.file";
        // Assertion: There should be _no_ other file roots when we initialize
        try {
            String testFilePath = ReferenceManager.instance().DeriveReference(testFileRoot).getLocalURI();
            String message = "Cannot setup sandbox. An Existing file root is set up, which directs to: " + testFilePath;
            Logger.log(LogTypes.TYPE_ERROR_DESIGN, message);
            throw new IllegalStateException(message);
        } catch (InvalidReferenceException ire) {
            // Expected.
        }


        ReferenceManager.instance().addReferenceFactory(fileRoot);

        // Double check that things point to the right place?
    }
} 
开发者ID:dimagi,项目名称:commcare-android,代码行数:23,代码来源:CommCareApp.java

示例11: setupAudioButton

import org.javarosa.core.reference.ReferenceManager; //导入依赖的package包/类
private void setupAudioButton(int rowId, AudioPlaybackButton audioPlaybackButton, MenuDisplayable menuDisplayable) {
    if (audioPlaybackButton != null) {
        final String audioURI = menuDisplayable.getAudioURI();
        String audioFilename = "";
        if (audioURI != null && !audioURI.equals("")) {
            try {
                audioFilename = ReferenceManager.instance().DeriveReference(audioURI).getLocalURI();
            } catch (InvalidReferenceException e) {
                Log.e("AVTLayout", "Invalid reference exception");
                e.printStackTrace();
            }
        }

        File audioFile = new File(audioFilename);
        // First set up the audio button
        ViewId viewId = ViewId.buildListViewId(rowId);
        if (!"".equals(audioFilename) && audioFile.exists()) {
            audioPlaybackButton.modifyButtonForNewView(viewId, audioURI, true);
        } else {
            audioPlaybackButton.modifyButtonForNewView(viewId, audioURI, false);
        }
    }
} 
开发者ID:dimagi,项目名称:commcare-android,代码行数:24,代码来源:MenuAdapter.java

示例12: removeAttachment

import org.javarosa.core.reference.ReferenceManager; //导入依赖的package包/类
@Override
protected void removeAttachment(Case caseForBlock, String attachmentName) {
    if (!processAttachments) {
        return;
    }

    //TODO: All of this code should really be somewhere else, too, since we also need to remove attachments on
    //purge.
    String source = caseForBlock.getAttachmentSource(attachmentName);

    //TODO: Handle remote reference download?
    if (source == null) {
        return;
    }

    //Handle these cases better later.
    try {
        ReferenceManager.instance().DeriveReference(source).remove();
    } catch (InvalidReferenceException | IOException e) {
        e.printStackTrace();
    }
} 
开发者ID:dimagi,项目名称:commcare-android,代码行数:23,代码来源:AndroidCaseXmlParser.java

示例13: updateFilePath

import org.javarosa.core.reference.ReferenceManager; //导入依赖的package包/类
/**
 * At some point hopefully soon we're not going to be shuffling our xforms around like crazy, so updates will mostly involve
 * just changing where the provider points.
 */
private boolean updateFilePath() {
    String localRawUri;
    try {
        localRawUri = ReferenceManager.instance().DeriveReference(this.localLocation).getLocalURI();
    } catch (InvalidReferenceException e) {
        Logger.log(LogTypes.TYPE_RESOURCES, "Installed resource wasn't able to be derived from " + localLocation);
        return false;
    }

    //We're maintaining this whole Content setup now, so we've goota update things when we move them.
    ContentResolver cr = CommCareApplication.instance().getContentResolver();

    ContentValues cv = new ContentValues();
    cv.put(FormsProviderAPI.FormsColumns.FORM_FILE_PATH, new File(localRawUri).getAbsolutePath());

    //Update the form file path
    int updatedRows = cr.update(Uri.parse(this.contentUri), cv, null, null);
    if (updatedRows > 1) {
        throw new RuntimeException("Bad URI stored for xforms installer: " + this.contentUri);
    }
    return updatedRows != 0;
} 
开发者ID:dimagi,项目名称:commcare-android,代码行数:27,代码来源:XFormAndroidInstaller.java

示例14: initialize

import org.javarosa.core.reference.ReferenceManager; //导入依赖的package包/类
@Override
public boolean initialize(AndroidCommCarePlatform platform, boolean isUpgrade) {
    try {

        Reference local = ReferenceManager.instance().DeriveReference(localLocation);

        ProfileParser parser = new ProfileParser(local.getStream(), platform, platform.getGlobalResourceTable(), null,
                Resource.RESOURCE_STATUS_INSTALLED, false);

        Profile p = parser.parse();
        platform.setProfile(p);

        return true;
    } catch (UnfullfilledRequirementsException | XmlPullParserException
            | InvalidStructureException | IOException
            | InvalidReferenceException e) {
        e.printStackTrace();
    }

    return false;
} 
开发者ID:dimagi,项目名称:commcare-android,代码行数:22,代码来源:ProfileAndroidInstaller.java

示例15: addDerivedLocation

import org.javarosa.core.reference.ReferenceManager; //导入依赖的package包/类
/**
 * Derive a reference from the given location and context; adding it to the
 * vector of references.
 *
 * @param location Contains a reference to a resource.
 * @param context  Provides context for any relative reference accessors.
 *                 Can be null.
 * @param ret      Add derived reference of location to this Vector.
 */
private static void addDerivedLocation(ResourceLocation location,
                                       Reference context,
                                       Vector<Reference> ret) {
    try {
        final Reference derivedRef;
        if (context == null) {
            derivedRef =
                    ReferenceManager.instance().DeriveReference(location.getLocation());
        } else {
            // contextualize the location ref in terms of the multiple refs
            // pointing to different locations for the parent resource
            derivedRef =
                    ReferenceManager.instance().DeriveReference(location.getLocation(),
                            context);
        }
        ret.addElement(derivedRef);
    } catch (InvalidReferenceException e) {
        e.printStackTrace();
    }
} 
开发者ID:dimagi,项目名称:commcare-core,代码行数:30,代码来源:ResourceTable.java

本文标签属性:

示例:示例是什么意思

代码:代码零九

java:javascript18岁

ReferenceManager:ReferenceManager

上一篇:Java HeaderStyle类代码示例(javaheaderstyle类典型用法代码示例汇总)
下一篇:湖南属于哪个省(湖南属于)(湖南属于哪个省,湖南有哪些城市)

为您推荐