Exemple #1
0
 private static void configureKeys(MoveSCU main, CommandLine cl) {
   if (cl.hasOption("m")) {
     String[] keys = cl.getOptionValues("m");
     for (int i = 1; i < keys.length; i++, i++)
       main.addKey(CLIUtils.toTag(keys[i - 1]), StringUtils.split(keys[i], '/'));
   }
   if (cl.hasOption("L")) main.addLevel(cl.getOptionValue("L"));
   if (cl.hasOption("i")) main.setInputFilter(CLIUtils.toTags(cl.getOptionValues("i")));
 }
 public StringBuilder promptTo(StringBuilder sb, String indent) {
   String indent2 = indent + "  ";
   StringUtils.appendLine(sb, indent, "ApplicationEntity[title: ", AETitle);
   StringUtils.appendLine(sb, indent2, "alias titles: ", AETitleAliases);
   StringUtils.appendLine(sb, indent2, "desc: ", description);
   StringUtils.appendLine(sb, indent2, "acceptor: ", associationAcceptor);
   StringUtils.appendLine(sb, indent2, "initiator: ", associationInitiator);
   StringUtils.appendLine(sb, indent2, "installed: ", getAeInstalled());
   for (Connection conn : connections)
     conn.promptTo(sb, indent2).append(StringUtils.LINE_SEPARATOR);
   for (TransferCapability tc : getTransferCapabilities())
     tc.promptTo(sb, indent2).append(StringUtils.LINE_SEPARATOR);
   return sb.append(indent).append(']');
 }
 public IDWithIssuer(String cx) {
   String[] ss = StringUtils.split(cx, '^');
   this.id = ss[0];
   this.setIssuer(ss.length > 3 ? new Issuer(ss[3], '&') : null);
 }
  @Override
  public void init(ServletConfig config) throws ServletException {
    super.init(config);
    try {
      addJBossDirURLSystemProperties();
      String ldapPropertiesURL =
          StringUtils.replaceSystemProperties(
                  System.getProperty(
                      "org.dcm4chee.proxy.ldapPropertiesURL",
                      config.getInitParameter("ldapPropertiesURL")))
              .replace('\\', '/');
      String deviceName =
          System.getProperty(
              "org.dcm4chee.proxy.deviceName", config.getInitParameter("deviceName"));
      String jmxName =
          System.getProperty("org.dcm4chee.proxy.jmxName", config.getInitParameter("jmxName"));
      InputStream ldapConf = null;
      try {
        ldapConf = new URL(ldapPropertiesURL).openStream();
        Properties p = new Properties();
        p.load(ldapConf);
        LOG.info("Using LDAP Configuration Backend");
        LdapDicomConfiguration ldapConfig = new LdapDicomConfiguration(p);
        LdapHL7Configuration hl7Conf = new LdapHL7Configuration();
        ldapConfig.addDicomConfigurationExtension(hl7Conf);
        ldapConfig.addDicomConfigurationExtension(new LdapProxyConfigurationExtension());
        ldapConfig.addDicomConfigurationExtension(new LdapAuditLoggerConfiguration());
        ldapConfig.addDicomConfigurationExtension(new LdapAuditRecordRepositoryConfiguration());
        dicomConfig = ldapConfig;
        this.hl7Config = hl7Conf;
      } catch (FileNotFoundException e) {
        // check if there is an implementation of PrefsFactory provided and construct
        // DicomConfiguration accordingly
        PreferencesDicomConfiguration prefsConfig;
        if (!prefsFactoryInstance.isUnsatisfied()) {
          Preferences prefs = prefsFactoryInstance.get().getPreferences();
          LOG.info("Using custom Preferences implementation {}", prefs.getClass().toString());
          prefsConfig = new PreferencesDicomConfiguration(prefs);
        } else {
          prefsConfig = new PreferencesDicomConfiguration();
          LOG.info(
              "Using default Preferences implementation {}",
              prefsConfig.getRootPrefs().getClass().toString());
        }

        PreferencesHL7Configuration hl7Conf = new PreferencesHL7Configuration();
        prefsConfig.addDicomConfigurationExtension(hl7Conf);
        prefsConfig.addDicomConfigurationExtension(new PreferencesProxyConfigurationExtension());
        prefsConfig.addDicomConfigurationExtension(new PreferencesAuditLoggerConfiguration());
        prefsConfig.addDicomConfigurationExtension(
            new PreferencesAuditRecordRepositoryConfiguration());
        dicomConfig = prefsConfig;
        this.hl7Config = hl7Conf;
      } finally {
        SafeClose.close(ldapConf);
      }
      proxy = new Proxy(dicomConfig, hl7Config, deviceName);
      proxy.start();
      ProxyDeviceExtension proxyDev =
          proxy.getDevice().getDeviceExtension(ProxyDeviceExtension.class);
      mbean =
          ManagementFactory.getPlatformMBeanServer().registerMBean(proxy, new ObjectName(jmxName));
    } catch (Exception e) {
      if (LOG.isDebugEnabled()) e.printStackTrace();
      destroy();
      throw new ServletException(e);
    }
  }