|
From: <gun...@us...> - 2008-04-21 09:19:27
|
Revision: 6198
http://dcm4che.svn.sourceforge.net/dcm4che/?rev=6198&view=rev
Author: gunterze
Date: 2008-04-21 02:19:19 -0700 (Mon, 21 Apr 2008)
Log Message:
-----------
[#DCMEE-809] StorageSCP: Replace attribute FilePathComponents by ReferencedDirectoryPath
Modified Paths:
--------------
dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/etc/conf/xmdesc/dcm4chee-storescp-xmbean.xml
dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/dcm/storescp/StoreScp.java
dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/dcm/storescp/StoreScpService.java
Modified: dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/etc/conf/xmdesc/dcm4chee-storescp-xmbean.xml
===================================================================
--- dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/etc/conf/xmdesc/dcm4chee-storescp-xmbean.xml 2008-04-18 14:45:52 UTC (rev 6197)
+++ dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/etc/conf/xmdesc/dcm4chee-storescp-xmbean.xml 2008-04-21 09:19:19 UTC (rev 6198)
@@ -242,17 +242,23 @@
</descriptors>
</attribute>
<attribute access="read-write"
- getMethod="getFilePathComponents"
- setMethod="setFilePathComponents">
- <description><![CDATA[Used to split directory path (mount point) from file path
- components in the (0040,E010) Retrieve URI, referring an already existing file
- of this object in a configured read-only file system. Only effective for receiving
- objects encoded with private Transfer Syntax: 1.2.40.0.13.1.1.2.4.94/Tiani URI Referenced.]]>
+ getMethod="getReferencedDirectoryPath"
+ setMethod="setReferencedDirectoryPath">
+ <description><![CDATA[Used to split directory path (mount point) from
+ file path in the (0040,E010) Retrieve URI of objects received with
+ private Transfer Syntax: 1.2.40.0.13.1.1.2.4.94/Tiani URI Referenced.
+ A relative path name is resolved relative to
+ <i>archive-install-directory</i>/server/default/. Alternatively an URI
+ can be specified. In any case, there must be already a file system
+ configured, which directory path match the value. If an URI is specified,
+ the (0040,E010) Retrieve URI in received objects must start with the value
+ + '/'. If a directory path is specified, the Retrieve URI must
+ start with 'file:' + absolute directory path. Otherwise the storage will fail.]]>
</description>
- <name>FilePathComponents</name>
- <type>int</type>
+ <name>ReferencedDirectoryPath</name>
+ <type>java.lang.String</type>
<descriptors>
- <value value="2"/>
+ <value value="archive"/>
</descriptors>
</attribute>
<attribute access="read-write"
Modified: dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/dcm/storescp/StoreScp.java
===================================================================
--- dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/dcm/storescp/StoreScp.java 2008-04-18 14:45:52 UTC (rev 6197)
+++ dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/dcm/storescp/StoreScp.java 2008-04-21 09:19:19 UTC (rev 6198)
@@ -56,8 +56,6 @@
import java.util.Date;
import java.util.Iterator;
import java.util.List;
-import java.util.StringTokenizer;
-
import javax.ejb.CreateException;
import javax.ejb.FinderException;
import javax.ejb.ObjectNotFoundException;
@@ -175,8 +173,10 @@
private boolean checkIncorrectWorklistEntry = true;
- private int filePathComponents = 2;
+ private String referencedDirectoryPath;
+ private String referencedDirectoryURI;
+
private boolean readReferencedFile = true;
private boolean md5sumReferencedFile = true;
@@ -294,18 +294,21 @@
this.hourInFilePath = hourInFilePath;
}
- public final int getFilePathComponents() {
- return filePathComponents;
+ public final String getReferencedDirectoryPath() {
+ return referencedDirectoryPath;
}
- public final void setFilePathComponents(int filePathComponents) {
- if (filePathComponents < 1) {
- throw new IllegalArgumentException("filePathComponents: "
- + filePathComponents);
- }
- this.filePathComponents = filePathComponents;
+ public final void setReferencedDirectoryPath(String pathOrURI) {
+ String trimmed = pathOrURI.trim();
+ referencedDirectoryURI = isURI(trimmed) ? (trimmed + '/') :
+ FileUtils.toFile(trimmed).toURI().toString();
+ referencedDirectoryPath = trimmed;
}
+ private static boolean isURI(String pathOrURI) {
+ return pathOrURI.indexOf(':') > 1 ;
+ }
+
public final boolean isMd5sumReferencedFile() {
return md5sumReferencedFile;
}
@@ -477,33 +480,21 @@
Status.DataSetDoesNotMatchSOPClassError,
"Missing (0040,E010) Retrieve URI - required for Tiani Retrieve URI Transfer Syntax");
}
- StringTokenizer stk = new StringTokenizer(uri, "/");
- int dirPathComponents = stk.countTokens() - filePathComponents
- - 1;
- if (dirPathComponents < 1 || !stk.nextToken().equals("file:")) {
+ if (!uri.startsWith(referencedDirectoryURI)) {
throw new DcmServiceException(
Status.DataSetDoesNotMatchSOPClassError,
- "Illegal (0040,E010) Retrieve URI: " + uri);
+ "(0040,E010) Retrieve URI: " + uri
+ + " does not match with configured Referenced Directory Path: "
+ + referencedDirectoryPath);
}
- StringBuffer sb = new StringBuffer();
- String dirPath = null;
- for (int i = 0; stk.hasMoreTokens(); i++) {
- if (i == dirPathComponents) {
- dirPath = sb.toString();
- sb.setLength(0);
- } else {
- sb.append('/');
- }
- sb.append(stk.nextToken());
- }
- filePath = sb.toString();
- file = FileUtils.toFile(dirPath, filePath);
+ filePath = uri.substring(referencedDirectoryURI.length());
+ file = FileUtils.toFile(referencedDirectoryPath, filePath);
if (!file.isFile()) {
throw new DcmServiceException(Status.ProcessingFailure,
"File referenced by (0040,E010) Retrieve URI: "
+ uri + " not found!");
}
- fsDTO = getFileSystemMgt().getFileSystem(dirPath);
+ fsDTO = getFileSystemMgt().getFileSystem(referencedDirectoryPath);
if (readReferencedFile) {
log.info("M-READ " + file);
Dataset fileDS = objFact.newDataset();
Modified: dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/dcm/storescp/StoreScpService.java
===================================================================
--- dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/dcm/storescp/StoreScpService.java 2008-04-18 14:45:52 UTC (rev 6197)
+++ dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/dcm/storescp/StoreScpService.java 2008-04-21 09:19:19 UTC (rev 6198)
@@ -270,12 +270,12 @@
scp.setHourInFilePath(enable);
}
- public final int getFilePathComponents() {
- return scp.getFilePathComponents();
+ public final String getReferencedDirectoryPath() {
+ return scp.getReferencedDirectoryPath();
}
- public final void setFilePathComponents(int filePathComponents) {
- scp.setFilePathComponents(filePathComponents);
+ public final void setReferencedDirectoryPath(String pathOrURI) {
+ scp.setReferencedDirectoryPath(pathOrURI);
}
public final boolean isReadReferencedFile() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|