|
From: <gun...@us...> - 2008-01-18 15:34:19
|
Revision: 5722
http://dcm4che.svn.sourceforge.net/dcm4che/?rev=5722&view=rev
Author: gunterze
Date: 2008-01-18 07:34:15 -0800 (Fri, 18 Jan 2008)
Log Message:
-----------
[#DCMEE-706] MPPSScu: Avoid MPPS "Ping Pong"
Modified Paths:
--------------
dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/etc/conf/xmdesc/dcm4chee-mppsscu-xmbean.xml
dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/dcm/mppsscp/MPPSScp.java
dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/dcm/mppsscu/MPPSScuService.java
Modified: dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/etc/conf/xmdesc/dcm4chee-mppsscu-xmbean.xml
===================================================================
--- dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/etc/conf/xmdesc/dcm4chee-mppsscu-xmbean.xml 2008-01-18 15:33:32 UTC (rev 5721)
+++ dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/etc/conf/xmdesc/dcm4chee-mppsscu-xmbean.xml 2008-01-18 15:34:15 UTC (rev 5722)
@@ -20,11 +20,22 @@
</constructor>
<!-- Attributes -->
- <attribute access="read-write" getMethod="getForwardAETs" setMethod="setForwardAETs">
- <description>List of AE titles for the application entities that MPPS messages are forwarded to, separated by \(backslash).
- NONE = do not forward MPPS messages to any application entities.
+ <attribute access="read-write" getMethod="getForwardingRules" setMethod="setForwardingRules">
+ <description><![CDATA[List of forwarding rules, dependent upon which
+ application - identified by the Calling AE title - sent the MPPS.
+ The comma separated list of AE titles after the (optional) condition
+ defines the forwarding destination (the other MPPS SCP) by its Called
+ AE Title.
+ <br>Format:
+ <br>[calling[!]=<i>aeTitleFrom</i>]<i>aeTitleTo</i> | NONE
+ <br>where
+ <br><i>aeTitleFrom</i> = the calling AE titles separated by '|' (pipe)
+ <br><i>aeTitleTo</i> = the AE titles that objects are forwarded to, in a comma-separated list
+ <br>NONE = do not use any forwarding rules.
+ <br><br>Example: [calling!=SCU1]SCP2
+ <br>Forwards received MPPS to SCU2, except MPPS received from SCU1]]>
</description>
- <name>ForwardAETitles</name>
+ <name>ForwardingRules</name>
<type>java.lang.String</type>
<descriptors>
<value value="NONE"/>
Modified: dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/dcm/mppsscp/MPPSScp.java
===================================================================
--- dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/dcm/mppsscp/MPPSScp.java 2008-01-18 15:33:32 UTC (rev 5721)
+++ dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/dcm/mppsscp/MPPSScp.java 2008-01-18 15:34:15 UTC (rev 5722)
@@ -55,6 +55,7 @@
import org.dcm4che.net.DcmServiceException;
import org.dcm4che.net.Dimse;
import org.dcm4chex.archive.common.PPSStatus;
+import org.dcm4chex.archive.common.PrivateTags;
import org.dcm4chex.archive.ejb.interfaces.MPPSManager;
import org.dcm4chex.archive.ejb.interfaces.MPPSManagerHome;
import org.dcm4chex.archive.util.EJBHomeFactory;
@@ -117,6 +118,8 @@
mpps.putUI(Tags.SOPClassUID, cuid);
mpps.putUI(Tags.SOPInstanceUID, iuid);
createMPPS(mpps);
+ mpps.setPrivateCreatorID(PrivateTags.CreatorID);
+ mpps.putAE(PrivateTags.CallingAET, as.getCallingAET());
service.sendMPPSNotification(mpps, MPPSScpService.EVENT_TYPE_MPPS_RECEIVED);
return null;
}
@@ -155,6 +158,8 @@
checkSetAttributs(mpps);
mpps.putUI(Tags.SOPInstanceUID, iuid);
updateMPPS(mpps);
+ mpps.setPrivateCreatorID(PrivateTags.CreatorID);
+ mpps.putAE(PrivateTags.CallingAET, as.getCallingAET());
service.sendMPPSNotification(mpps, MPPSScpService.EVENT_TYPE_MPPS_RECEIVED);
return null;
}
Modified: dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/dcm/mppsscu/MPPSScuService.java
===================================================================
--- dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/dcm/mppsscu/MPPSScuService.java 2008-01-18 15:33:32 UTC (rev 5721)
+++ dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/dcm/mppsscu/MPPSScuService.java 2008-01-18 15:34:15 UTC (rev 5722)
@@ -39,6 +39,9 @@
package org.dcm4chex.archive.dcm.mppsscu;
+import java.util.HashMap;
+import java.util.Map;
+
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
@@ -57,7 +60,8 @@
import org.dcm4che.net.AssociationFactory;
import org.dcm4che.net.DcmServiceException;
import org.dcm4che.net.Dimse;
-import org.dcm4cheri.util.StringUtils;
+import org.dcm4chex.archive.common.PrivateTags;
+import org.dcm4chex.archive.config.ForwardingRules;
import org.dcm4chex.archive.config.RetryIntervalls;
import org.dcm4chex.archive.dcm.AbstractScuService;
import org.dcm4chex.archive.dcm.mppsscp.MPPSScpService;
@@ -74,17 +78,21 @@
private static final int PCID_MPPS = 1;
- private static final String NONE = "NONE";
-
- private static final String[] EMPTY = {};
-
private static final int[] EXCLUDE_TAGS = { Tags.SOPClassUID,
Tags.SOPInstanceUID };
private RetryIntervalls retryIntervalls = new RetryIntervalls();
- private String[] forwardAETs = EMPTY;
+ private ForwardingRules forwardingRules = new ForwardingRules("");
+ public final String getForwardingRules() {
+ return forwardingRules.toString();
+ }
+
+ public final void setForwardingRules(String forwardingRules) {
+ this.forwardingRules = new ForwardingRules(forwardingRules);
+ }
+
private ObjectName mppsScpServiceName;
private String queueName;
@@ -118,16 +126,6 @@
}
}
- public final String getForwardAETs() {
- return forwardAETs.length > 0 ? StringUtils.toString(forwardAETs, '\\')
- : NONE;
- }
-
- public final void setForwardAETs(String forwardAETs) {
- this.forwardAETs = NONE.equalsIgnoreCase(forwardAETs) ? EMPTY
- : StringUtils.split(forwardAETs, '\\');
- }
-
public final ObjectName getMppsScpServiceName() {
return mppsScpServiceName;
}
@@ -166,8 +164,15 @@
public void handleNotification(Notification notif, Object handback) {
Dataset mpps = (Dataset) notif.getUserData();
- for (int i = 0; i < forwardAETs.length; i++) {
- MPPSOrder order = new MPPSOrder(mpps, forwardAETs[i]);
+ mpps.setPrivateCreatorID(PrivateTags.CreatorID);
+ Map param = new HashMap();
+ param.put("calling", new String[] {
+ mpps.getString(PrivateTags.CallingAET) });
+ String[] destAETs = forwardingRules
+ .getForwardDestinationsFor(param);
+ for (int i = 0; i < destAETs.length; i++) {
+ MPPSOrder order = new MPPSOrder(mpps.excludePrivate(),
+ ForwardingRules.toAET(destAETs[i]));
try {
log.info("Scheduling " + order);
jmsDelegate.queue(queueName, order, Message.DEFAULT_PRIORITY,
@@ -228,7 +233,7 @@
.getString(Tags.SOPInstanceUID));
}
Dimse dimseRq = AssociationFactory.getInstance()
- .newDimse(PCID_MPPS, cmdRq, mpps.exclude(EXCLUDE_TAGS));
+ .newDimse(PCID_MPPS, cmdRq, mpps.exclude(EXCLUDE_TAGS));
final Dimse dimseRsp = aa.invoke(dimseRq).get();
final Command cmdRsp = dimseRsp.getCommand();
final int status = cmdRsp.getStatus();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|