Package uk.gov.nationalarchives.droid.profile

Examples of uk.gov.nationalarchives.droid.profile.ProfileInstance


        ProfileSpec profileSpec = mock(ProfileSpec.class);
        List<AbstractProfileResource> resources = buildFileResources(locations);
        when(profileSpec.getResources()).thenReturn(resources);
       
        ProfileInstance profile = mock(ProfileInstance.class);
        when(profile.getProfileSpec()).thenReturn(profileSpec);

        ProfileSpecWalkerImpl walker = new ProfileSpecWalkerImpl();
        ProgressMonitor progressMonitor = mock(ProgressMonitor.class);
        walker.setProgressMonitor(progressMonitor);
View Full Code Here


        ProfileSpec profileSpec = mock(ProfileSpec.class);
        List<AbstractProfileResource> resources = buildDirectoryResources(locations);
        when(profileSpec.getResources()).thenReturn(resources);

        ProfileInstance profile = mock(ProfileInstance.class);
        when(profile.getProfileSpec()).thenReturn(profileSpec);

        ProfileSpecWalkerImpl walker = new ProfileSpecWalkerImpl();
        ProgressMonitor progressMonitor = mock(ProgressMonitor.class);
        walker.setProgressMonitor(progressMonitor);
        FileEventHandler fileEventHandler = mock(FileEventHandler.class);
View Full Code Here

        ProfileSpec profileSpec = mock(ProfileSpec.class);
        List<AbstractProfileResource> resources = buildRecursiveDirectoryResources(locations);
        when(profileSpec.getResources()).thenReturn(resources);

        ProfileInstance profile = mock(ProfileInstance.class);
        when(profile.getProfileSpec()).thenReturn(profileSpec);
        ProfileSpecWalkerImpl walker = new ProfileSpecWalkerImpl();
       
        ProgressMonitor progressMonitor = mock(ProgressMonitor.class);
        walker.setProgressMonitor(progressMonitor);
        FileEventHandler fileEventHandler = mock(FileEventHandler.class);
View Full Code Here

     */
    public List<ProfileForm> allDirtyProfiles() {
        List<ProfileForm> dirtyProfiles = new ArrayList<ProfileForm>();
       
        for (ProfileForm profile : profiles.values()) {
            ProfileInstance profileInstance = profile.getProfile();
            if (profileInstance.isDirty()) {
                dirtyProfiles.add(profile);
            }
        }

        return Collections.unmodifiableList(dirtyProfiles);
View Full Code Here

     */
    public List<ProfileForm> allRunningProfiles() {
        List<ProfileForm> runningProfiles = new ArrayList<ProfileForm>();
       
        for (ProfileForm profile : profiles.values()) {
            ProfileInstance profileInstance = profile.getProfile();
            if (profileInstance.getState().equals(ProfileState.RUNNING)) {
                runningProfiles.add(profile);
            }
        }

        return Collections.unmodifiableList(runningProfiles);
View Full Code Here

    }

    @Override
    protected void done() {
        try {
            ProfileInstance profile = get();
           
            // initialise the progress
            ProgressState prog = profile.getProgress();
            int progress;
            if (prog == null) {
                progress = 0;
            } else {
                progress = (int) (UNITY_PERCENT * prog.getCount() / prog.getTarget());
            }
            profilePanel.getProfileProgressBar().setValue(progress);

            profilePanel.setProfile(profile);
            profilePanel.getStatusLabel().setText("Profile Loaded OK.");

            profilePanel.setName(profile.getName());
            context.addProfileForm(profile.getUuid(), profilePanel);

            // populate the outline with the first-level nodes
            DefaultTreeModel treeModel = profilePanel.getTreeModel();
            DefaultMutableTreeNode rootNode = (DefaultMutableTreeNode) treeModel.getRoot();
           
            for (ProfileResourceNode profileNode : profileManager.findRootNodes(profile.getUuid())) {
                boolean allowsChildren = profileNode.allowsChildren()
                    && !NodeStatus.NOT_DONE.equals(profileNode.getMetaData().getNodeStatus());
                DefaultMutableTreeNode treeNode = new DefaultMutableTreeNode(profileNode, allowsChildren);
                rootNode.add(treeNode);
            }
View Full Code Here

     */
    public void add(Collection<File> selectedFiles, boolean recursive) {
       
        ProfileForm selectedProfile = droidContext.getSelectedProfile();
        DefaultTreeModel treeModel = selectedProfile.getTreeModel();
        ProfileInstance profile = selectedProfile.getProfile();
        ProfileSpec profileSpec = profile.getProfileSpec();
       
        DefaultMutableTreeNode rootNode = (DefaultMutableTreeNode) treeModel.getRoot();
        for (File selectedFile : selectedFiles) {
            AbstractProfileResource newResource;
           
            // VERY basic shortcut detection:
            boolean isShortcut = !selectedFile.toURI().getPath().endsWith("/");
            if (selectedFile.isDirectory() && !isShortcut) {
                newResource = new DirectoryProfileResource(selectedFile, recursive);
            } else {
                newResource = new FileProfileResource(selectedFile);
            }

            if (profile.addResource(newResource)) {
                ProfileResourceNode primordialNode = new ProfileResourceNode(newResource.getUri());
                final NodeMetaData metaData = primordialNode.getMetaData();
                metaData.setName(newResource.getUri().getPath());
                metaData.setNodeStatus(NodeStatus.NOT_DONE);
                metaData.setResourceType(
                        newResource.isDirectory() ? ResourceType.FOLDER : ResourceType.FILE);

                DefaultMutableTreeNode node = new DefaultMutableTreeNode(primordialNode, false);
                int index = rootNode.getChildCount();
                treeModel.insertNodeInto(node, rootNode, index);
            }
        }
        profileManager.updateProfileSpec(profile.getUuid(), profileSpec);
//        if (profile.isDirty()) {
//            selectedProfile.onResourceChanged();
//        }
    }
View Full Code Here

            final ProfileForm profileForm, FileChooserProxy dialog) {
       
        this.dialog = dialog;
        this.profileManager = profileManager;
        this.profileForm = profileForm;
        ProfileInstance profile = profileForm.getProfile();
       
        profileId = profile.getUuid();

        callback = new ProgressObserver() {
            @Override
            public void onProgress(Integer progress) {
                setProgress(progress);
View Full Code Here

        execute();
    }
   
    @Override
    protected ProfileInstance doInBackground() throws IOException {
        ProfileInstance profile = profileManager.save(profileId, destination, callback);
        return profile;
    }
View Full Code Here

    }
   
    @Override
    protected void done() {
        try {
            ProfileInstance profile = get();
            profileForm.setName(profile.getName());
        } catch (InterruptedException e) {
            log.debug(e);
            throw new RuntimeException(e.getMessage(), e);
        } catch (ExecutionException e) {
            log.error(e.getMessage(), e);
View Full Code Here

TOP

Related Classes of uk.gov.nationalarchives.droid.profile.ProfileInstance

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.