Package uk.gov.nationalarchives.droid.profile

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


        ProfileForm selectedProfile = droidContext.getSelectedProfile();

        DefaultTreeModel treeMdl = selectedProfile.getTreeModel();
        Outline outline = selectedProfile.getResultsOutline();
        ProfileInstance profile = selectedProfile.getProfile();

        int[] selectedRows = outline.getSelectedRows();

        for (int i = selectedRows.length; i > 0; i--) {
            // remove node from profile spec
            int index = selectedRows[i - 1];

            DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) outline
                    .getValueAt(index, 0);
            ProfileResourceNode prn = (ProfileResourceNode) treeNode
                    .getUserObject();
            if (profile.removeResource(prn.getUri())) {
                treeMdl.removeNodeFromParent(treeNode);
            }
        }

        profileManager.updateProfileSpec(
                selectedProfile.getProfile().getUuid(), profile
                        .getProfileSpec());
//        if (profile.isDirty()) {
//            selectedProfile.onResourceChanged();
//        }
View Full Code Here


        public void propertyChange(PropertyChangeEvent evt) {
            if ("state".equals(evt.getPropertyName())
                    && evt.getNewValue() == SwingWorker.StateValue.DONE) {
                try {
                    Future<ProfileInstance> job = (Future<ProfileInstance>) evt.getSource();
                    ProfileInstance profile = job.get();
                    profileManager.closeProfile(profile.getUuid());
                    context.remove(profile.getUuid());
                } catch (InterruptedException e) {
                    log.debug(e);
                    throw new RuntimeException(e.getMessage(), e);
                } catch (ExecutionException e) {
                    cancel(true);
View Full Code Here

    private FilterImpl getFilter() {
        FilterImpl result = null;
        ProfileForm form = droidContext.getSelectedProfile();
        if (form != null) {
            ProfileInstance instance = form.getProfile();
            if (instance != null) {
                result = instance.getFilter();
            }
        }
        return result;
    }
View Full Code Here

                if (!profileContextLocator.hasProfileContext(profileId)) {
                    final String message = String.format(PROJECT_NOT_AVAILABLE_FOR_EXPORT, profileId);
                    log.warn(message);
                    throw new RuntimeException(message);
                }
                ProfileInstance profile = profileContextLocator.getProfileInstance(profileId);
                ProfileInstanceManager profileContext = profileContextLocator.openProfileInstanceManager(profile);
                ItemReader<ProfileResourceNode> reader = profileContext.getNodeItemReader();
                ItemReaderCallback<ProfileResourceNode> callback = new ItemReaderCallback<ProfileResourceNode>() {
                    @Override
                    public void onItem(List<? extends ProfileResourceNode> itemChunk)
                        throws JobCancellationException {
                        itemWriter.write(itemChunk);
                        if (cancelled) {
                            log.info("Export interrupted");
                            throw new JobCancellationException("Cancelled");
                        }
                    }
                };

                Filter filter = filterOverride != null ? filterOverride : profile.getFilter();
                reader.readAll(callback, filter);
                stopWatch.stop();
                log.info(String.format("Time for export [%s]: %s ms", profileId, stopWatch.getTime()));
                stopWatch.reset();
            }
View Full Code Here

            if (!this.profileContextLocator.hasProfileContext(profileId)) {
                final String message = String.format(PROJECT_NOT_AVAILABLE_FOR_EXPORT, profileId);
                log.warn(message);
                throw new RuntimeException(message);
            }
            ProfileInstance profile = profileContextLocator.getProfileInstance(profileId);
            if (profile.getGenerateHash()) {
                algorithmsFound.add(profile.getHashAlgorithm().toUpperCase());
            }
        }
       
        // If the count is 1, this means that at least one profile in the export cohort was run with hash generation, 
        // and that only a single hash algorithm was used for all the profiles in the export (e.g. not one with MD5
View Full Code Here

    @Test
    public void testExportNodesToCsv() throws Exception {
       
        ProfileInstanceManager profileInstanceManager = mock(ProfileInstanceManager.class);
        ProfileInstance profile1 = mock(ProfileInstance.class);
       
        when(profileContextLocator.getProfileInstance("profile1")).thenReturn(profile1);
        when(profileContextLocator.hasProfileContext(anyString())).thenReturn(true);
        when(profileInstanceManager.getNodeItemReader()).thenReturn(reader);
        when(profileContextLocator.openProfileInstanceManager(profile1)).thenReturn(profileInstanceManager);
View Full Code Here

    @Test
    public void testEndToEndExportOfOneProfile() throws Exception {
       
       
        // create a new profile and run it
        ProfileInstance testProfile = profileContextLocator.getProfileInstance("test");
        testProfile.setProfileSpec(new ProfileSpec());
       
        File profileHomeDir = new File(config.getProfilesDir(), "test");
        // Delete any renmants...
        FileUtils.deleteDirectory(profileHomeDir);
       
        final File sigFile = new File("sig_files/DROID_SignatureFile_V26.xml");
        FileUtils.copyFileToDirectory(sigFile, profileHomeDir);
        testProfile.setSignatureFileName("DROID_SignatureFile_V26.xml");
        String path = "C:/Documents and Settings/rflitcroft/My Documents/matts_disk";
        //String path = "src/test/resources";
        testProfile.addResource(new DirectoryProfileResource(new File(path), true));
       
        ProfileInstanceManager profileInstance = profileContextLocator.openProfileInstanceManager(testProfile);
        //profileInstance.initProfile(sigFile.toURI());
        profileInstance.start().get();
       
View Full Code Here

    public void testMovingThrottleSliderUpdatesThrottle() throws Exception {
       
        final DroidUIContext context = mock(DroidUIContext.class);
        final ProfileManager profileManager = mock(ProfileManager.class);
        final DroidMainFrame mainFrame = mock(DroidMainFrame.class);
        final ProfileInstance profile = mock(ProfileInstance.class);
       
        final String profileId = "abcd";
        when(profile.getUuid()).thenReturn(profileId);
       
        final ProfileEventListener listener = mock(ProfileEventListener.class);
       
        when(context.getProfileManager()).thenReturn(profileManager);
       
View Full Code Here

        final String profileId = "abcd";
       
        final DroidUIContext context = mock(DroidUIContext.class);
        ProfileManager profileManager = mock(ProfileManager.class);
        final DroidMainFrame mainFrame = mock(DroidMainFrame.class);
        final ProfileInstance profile = mock(ProfileInstance.class);
       
        when(profile.getUuid()).thenReturn(profileId);
       
        final ProfileEventListener listener = mock(ProfileEventListener.class);
       
        when(context.getProfileManager()).thenReturn(profileManager);
       
View Full Code Here

        long startTime = System.currentTimeMillis();
        if (!profileContextLocator.hasProfileContext(profileId)) {
            throw new RuntimeException("Profile not available");
        }
        ProfileInstance profile = profileContextLocator.getProfileInstance(profileId);
        ProfileInstanceManager profileInstancemanager = profileContextLocator.openProfileInstanceManager(profile);

        PlanetsXMLData planetsData = profileInstancemanager.getPlanetsData();

        planetsData.getProfileStat().setProfileStartDate(profile.getProfileStartDate());
        planetsData.getProfileStat().setProfileEndDate(profile.getProfileEndDate());
        planetsData.getProfileStat().setProfileSaveDate(profile.getDateCreated());

        planetsData.setTopLevelItems(ReportUtils.toResourcePaths(profile.getProfileSpec().getResources()));

        PlanetsXMLGenerator planetXMLGenerator = new PlanetsXMLGenerator(observer, nameAndPathOfTheFile, planetsData);
        planetXMLGenerator.generate();

        long stopTime = System.currentTimeMillis();
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.