Package org.dcm4che3.net

Examples of org.dcm4che3.net.ApplicationEntity


        }
        List<Connection> devConns = device.listConnections();
        Preferences aesNode = deviceNode.node("dcmNetworkAE");
        for (String aet : aesNode.childrenNames()) {
            Preferences aeNode = aesNode.node(aet);
            ApplicationEntity ae = newApplicationEntity(aeNode);
            loadFrom(ae, aeNode);
            int n = aeNode.getInt("dicomNetworkConnectionReference.#", 0);
            for (int i = 0; i < n; i++) {
                ae.addConnection(devConns.get(
                        aeNode.getInt("dicomNetworkConnectionReference." + (i+1), 0) - 1));
            }
            loadChilds(ae, aeNode);
            device.addApplicationEntity(ae);
        }
View Full Code Here


    private Connection newConnection() {
        return new Connection();
    }

    private ApplicationEntity newApplicationEntity(Preferences aeNode) {
        return new ApplicationEntity(aeNode.name());
    }
View Full Code Here

    }

    private ApplicationEntity loadApplicationEntity(SearchResult sr,
            String deviceDN, Device device) throws NamingException {
        Attributes attrs = sr.getAttributes();
        ApplicationEntity ae = new ApplicationEntity(LdapUtils.stringValue(attrs.get("dicomAETitle"), null));
        loadFrom(ae, attrs);
        for (String connDN : LdapUtils.stringArray(attrs.get("dicomNetworkConnectionReference")))
            ae.addConnection(LdapUtils.findConnection(connDN, deviceDN, device));
        loadChilds(ae, sr.getNameInNamespace());
        return ae ;
    }
View Full Code Here

        try {
            config.removeDevice("Test-Device-1");
        catch (ConfigurationNotFoundException e) {}
        Device device = createDevice("Test-Device-1", "TEST-AET1");
        config.persist(device);
        ApplicationEntity ae = config.findApplicationEntity("TEST-AET1");
        assertFalse(ae.isAssociationInitiator());
        assertTrue(ae.isAssociationAcceptor());
        assertTrue(ae.getConnections().get(0).isServer());
        TransferCapability echoSCP = ae.getTransferCapabilityFor(
                UID.VerificationSOPClass, TransferCapability.Role.SCP);
        assertNotNull(echoSCP);
        assertArrayEquals(new String[] { UID.ImplicitVRLittleEndian }, echoSCP.getTransferSyntaxes());
        TransferCapability ctSCP = ae.getTransferCapabilityFor(
                UID.CTImageStorage, TransferCapability.Role.SCP);
        assertNotNull(ctSCP);
        assertArrayEquals(new String[] { UID.ImplicitVRLittleEndian, UID.ExplicitVRLittleEndian },
                sort(ctSCP.getTransferSyntaxes()));
        assertNull(ctSCP.getStorageOptions());
        TransferCapability findSCP = ae.getTransferCapabilityFor(
                UID.StudyRootQueryRetrieveInformationModelFIND, TransferCapability.Role.SCP);
        assertNotNull(findSCP);
        assertArrayEquals(new String[] { UID.ImplicitVRLittleEndian }, findSCP.getTransferSyntaxes());
        assertEquals(EnumSet.of(QueryOption.RELATIONAL), findSCP.getQueryOptions());
        assertEquals(1, config.listDeviceInfos(deviceInfo("Test-Device-1")).length);
View Full Code Here

        catch (ConfigurationNotFoundException e) {}
        Device device = createDevice("Test-Device-1", "TEST-AET1");
        config.persist(device);
        modifyDevice(device);
        config.merge(device);
        ApplicationEntity ae2 = config.findApplicationEntity("TEST-AET2");
        ApplicationEntity ae = ae2.getDevice().getApplicationEntity("TEST-AET1");
        assertTrue(ae.isAssociationInitiator());
        assertFalse(ae.isAssociationAcceptor());
        assertFalse(ae.getConnections().get(0).isServer());
        TransferCapability echoSCP = ae.getTransferCapabilityFor(
                UID.VerificationSOPClass, TransferCapability.Role.SCP);
        assertNull(echoSCP);
        TransferCapability echoSCU = ae.getTransferCapabilityFor(
                UID.VerificationSOPClass, TransferCapability.Role.SCU);
        assertNotNull(echoSCU);
        TransferCapability ctSCP = ae.getTransferCapabilityFor(
                UID.CTImageStorage, TransferCapability.Role.SCP);
        assertEquals(STORAGE_OPTIONS, ctSCP.getStorageOptions());
        TransferCapability findSCP = ae.getTransferCapabilityFor(
                UID.StudyRootQueryRetrieveInformationModelFIND, TransferCapability.Role.SCP);
        assertEquals(EnumSet.of(QueryOption.RELATIONAL, QueryOption.DATETIME),
                findSCP.getQueryOptions());
        config.removeDevice("Test-Device-1");
    }
View Full Code Here

    private static Device createDevice(String name, String aet) throws Exception {
        Device device = new Device(name);
        Connection conn = createConn("host.dcm4che.org", 11112);
        device.addConnection(conn);
        ApplicationEntity ae = createAE(aet, conn);
        device.addApplicationEntity(ae);
        return device ;
    }
View Full Code Here

            StorageOptions.LevelOfSupport.LEVEL_2,
            StorageOptions.DigitalSignatureSupport.LEVEL_1,
            StorageOptions.ElementCoercion.YES);

    private static ApplicationEntity createAE(String aet, Connection conn) {
        ApplicationEntity ae = new ApplicationEntity(aet);
        ae.setAssociationInitiator(false);
        ae.addConnection(conn);
        ae.addTransferCapability(echoSCP());
        ae.addTransferCapability(ctSCP());
        ae.addTransferCapability(findSCP());
        return ae;
    }
View Full Code Here

        ae.addTransferCapability(findSCP());
        return ae;
    }

    private static void modifyDevice(Device device) throws Exception  {
        ApplicationEntity ae = device.getApplicationEntity("TEST-AET1");
        ae.getConnections().get(0).setPort(Connection.NOT_LISTENING);
        ae.setAssociationInitiator(true);
        ae.setAssociationAcceptor(false);
        ae.getTransferCapabilityFor(
                    UID.VerificationSOPClass, TransferCapability.Role.SCP)
                .setRole(TransferCapability.Role.SCU);
        ae.addTransferCapability(echoSCU());
        ae.getTransferCapabilityFor(
                    UID.CTImageStorage, TransferCapability.Role.SCP)
                .setStorageOptions(STORAGE_OPTIONS);
        ae.getTransferCapabilityFor(
                    UID.StudyRootQueryRetrieveInformationModelFIND,
                    TransferCapability.Role.SCP)
                .getQueryOptions().add(QueryOption.DATETIME);
        Connection conn = createConn("host.dcm4che.org", 11114);
        device.addConnection(conn);
        ApplicationEntity ae2 = createAE("TEST-AET2", conn);
        device.addApplicationEntity(ae2);
    }
View Full Code Here

        conn.setHostname(host);
        conn.setPort(port);
        conn.setInstalled(true);
        setDestination(conn);

        this.setProbedAE(new ApplicationEntity(aeTitle));
        this.getProbedAE().addConnection(conn);
        this.setCallingAET(callingaet);
    }
View Full Code Here

    public void probeAndSet() {
        ProbeTC instance = this;
        Device device = new Device(instance.getCallingAET());
        Connection conn = new Connection();
        device.addConnection(conn);
        ApplicationEntity ae = new ApplicationEntity(instance.getCallingAET());
        device.addApplicationEntity(ae);
        ae.addConnection(conn);

        conn.setReceivePDULength(Connection.DEF_MAX_PDU_LENGTH);
        conn.setSendPDULength(Connection.DEF_MAX_PDU_LENGTH);

        conn.setMaxOpsInvoked(0);
        conn.setMaxOpsPerformed(0);

        conn.setPackPDV(true);
        conn.setConnectTimeout(0);
        conn.setRequestTimeout(0);
        conn.setAcceptTimeout(0);
        conn.setReleaseTimeout(0);
        conn.setResponseTimeout(0);
        conn.setRetrieveTimeout(0);
        conn.setIdleTimeout(0);
        conn.setSocketCloseDelay(Connection.DEF_SOCKETDELAY);
        conn.setSendBufferSize(0);
        conn.setReceiveBufferSize(0);
        conn.setTcpNoDelay(true);

        // no tls in this implementation (for tls use command line tool)
        if (instance.getConfigType().compareToIgnoreCase("ldap") == 0) {
            InputStream is = null;
            try {
                is = new FileInputStream(instance.getLdapConfigurationFile());
            } catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

            Properties p = new Properties();
            try {
                p.load(is);
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            try {
                LdapDicomConfiguration conf = new LdapDicomConfiguration(p);
                LOG.info("Started Loading LDAP configuration");
                ApplicationEntity sourceAE = conf
                        .findApplicationEntity(instance.sourceAET);
                ArrayList<TransferCapability> tcs = (ArrayList<TransferCapability>) sourceAE
                        .getTransferCapabilities();
                ArrayList<PresentationContext> pcs = addChunkedPCsandSend(ae,
                        device, instance, tcs);
                // print accepted ones
                ArrayList<PresentationContext> acceptedPCs = new ArrayList<PresentationContext>();
                for (PresentationContext pc : pcs)
                    if (pc.isAccepted())
                        acceptedPCs.add(pc);

                ApplicationEntity destinationAE = conf
                        .findApplicationEntity(instance.destinationAET);
                Device toStore = destinationAE.getDevice();
                TransferCapability[] TCs = mergeTCs(acceptedPCs);
                for (TransferCapability tc : TCs)
                    toStore.getApplicationEntity(instance.destinationAET)
                            .addTransferCapability(tc);

                conf.merge(toStore);
                conf.close();
                return;
            } catch (ConfigurationException e) {
                LOG.error("Configuration backend error - {}", e);
            }
        } else {

            try {
                PreferencesDicomConfiguration conf = new PreferencesDicomConfiguration();
                LOG.info("Started Loading LDAP configuration");
                ApplicationEntity sourceAE = conf
                        .findApplicationEntity(instance.sourceAET);
                ArrayList<TransferCapability> tcs = (ArrayList<TransferCapability>) sourceAE
                        .getTransferCapabilities();
                ArrayList<PresentationContext> pcs = addChunkedPCsandSend(ae,
                        device, instance, tcs);
                // print accepted ones
                ArrayList<PresentationContext> acceptedPCs = new ArrayList<PresentationContext>();
                for (PresentationContext pc : pcs)
                    if (pc.isAccepted())
                        acceptedPCs.add(pc);

                ApplicationEntity destinationAE = conf
                        .findApplicationEntity(instance.destinationAET);
                Device toStore = destinationAE.getDevice();
                TransferCapability[] TCs = mergeTCs(acceptedPCs);
                for (TransferCapability tc : TCs)
                    toStore.getApplicationEntity(instance.destinationAET)
                            .addTransferCapability(tc);
View Full Code Here

TOP

Related Classes of org.dcm4che3.net.ApplicationEntity

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.