test_class.declarator: slingSimulator = new DefaultSlingSimulator()
test_class.modifier: private
test_class.original_string: private DefaultSlingSimulator slingSimulator = new DefaultSlingSimulator();
test_class.type: DefaultSlingSimulator
test_class.var_name: slingSimulator
test_class.file: core/src/test/java/net/adamcin/oakpal/core/sling/DefaultSlingSimulatorTest.java
test_class.identifier: DefaultSlingSimulatorTest
test_case.body: @Test
      public void testReadDictionary_dotCfgJson() throws Exception {
  
          final Map<String, Object> expectConfig = new HashMap<>();
          expectConfig.put("foo", "bar");
          expectConfig.put("foos", Stream.of("bar", "bar", "bar").toArray(String[]::new));
          expectConfig.put("ones", Stream.of(1L, 1L, 1L).toArray(Long[]::new));
          expectConfig.put("nothing", new String[0]);
  
          final String dotCfgJson = obj()
                  .key("foo", "bar")
                  .key("foos", arr().val("bar").val("bar").val("bar"))
                  .key("ones", arr().val(1L).val(1L).val(1L))
                  .key("nothing", arr())
                  .get().toString();
          checkExpectedProperties(expectConfig, DefaultSlingSimulator.readDictionary(
                  new ByteArrayInputStream(dotCfgJson.getBytes(StandardCharsets.UTF_8)), "simple.cfg.json"));
          checkExpectedProperties(expectConfig, DefaultSlingSimulator.readDictionary(
                  new ByteArrayInputStream(dotCfgJson.getBytes(StandardCharsets.UTF_8)), "nested/simple.cfg.json"));
          checkExpectedProperties(expectConfig, DefaultSlingSimulator.readDictionary(
                  new ByteArrayInputStream(dotCfgJson.getBytes(StandardCharsets.UTF_8)), "nested/simple-inst.cfg.json"));
      }
test_case.class_method_signature: DefaultSlingSimulatorTest.testReadDictionary_dotCfgJson()
test_case.full_signature: @Test public void testReadDictionary_dotCfgJson()
test_case.identifier: testReadDictionary_dotCfgJson
test_case.invocations: put put toArray of put toArray of put toString get key key key key obj val val val arr val val val arr arr checkExpectedProperties readDictionary getBytes checkExpectedProperties readDictionary getBytes checkExpectedProperties readDictionary getBytes
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testReadDictionary_dotCfgJson()
focal_class.declarator: session
focal_class.modifier: private
focal_class.original_string: private Session session;
focal_class.type: Session
focal_class.var_name: session
focal_class.declarator: packageManager
focal_class.modifier: private
focal_class.original_string: private JcrPackageManager packageManager;
focal_class.type: JcrPackageManager
focal_class.var_name: packageManager
focal_class.declarator: errorListener
focal_class.modifier: private
focal_class.original_string: private ErrorListener errorListener;
focal_class.type: ErrorListener
focal_class.var_name: errorListener
focal_class.declarator: installables = new LinkedList<>()
focal_class.modifier: private final
focal_class.original_string: private final LinkedList<SlingInstallable> installables = new LinkedList<>();
focal_class.type: LinkedList<SlingInstallable>
focal_class.var_name: installables
focal_class.declarator: SLING_NS = "http://sling.apache.org/jcr/sling/1.0"
focal_class.modifier: static final
focal_class.original_string: static final String SLING_NS = "http://sling.apache.org/jcr/sling/1.0";
focal_class.type: String
focal_class.var_name: SLING_NS
focal_class.declarator: SLING_OSGI_CONFIG = "{" + SLING_NS + "}OsgiConfig"
focal_class.modifier: static final
focal_class.original_string: static final String SLING_OSGI_CONFIG = "{" + SLING_NS + "}OsgiConfig";
focal_class.type: String
focal_class.var_name: SLING_OSGI_CONFIG
focal_class.declarator: JCR_CONTENT_DATA = "jcr:content/jcr:data"
focal_class.modifier: static final
focal_class.original_string: static final String JCR_CONTENT_DATA = "jcr:content/jcr:data";
focal_class.type: String
focal_class.var_name: JCR_CONTENT_DATA
focal_class.declarator: EXTENSIONS = Arrays.asList(".config", ".properties", ".cfg", ".cfg.json")
focal_class.modifier: private static final
focal_class.original_string: private static final List<String> EXTENSIONS = Arrays.asList(".config", ".properties", ".cfg", ".cfg.json");
focal_class.type: List<String>
focal_class.var_name: EXTENSIONS
focal_class.file: core/src/main/java/net/adamcin/oakpal/core/sling/DefaultSlingSimulator.java
focal_class.identifier: DefaultSlingSimulator
focal_class.interfaces: implements SlingSimulatorBackend, SlingSimulator
focal_class.class_method_signature: DefaultSlingSimulator.instance()
focal_class.full_signature: public static SlingSimulatorBackend instance()
focal_class.identifier: instance
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: SlingSimulatorBackend
focal_class.signature: SlingSimulatorBackend instance()
focal_class.class_method_signature: DefaultSlingSimulator.startedScan()
focal_class.full_signature: @Override public void startedScan()
focal_class.identifier: startedScan
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void startedScan()
focal_class.class_method_signature: DefaultSlingSimulator.setSession(final Session session)
focal_class.full_signature: @Override public void setSession(final Session session)
focal_class.identifier: setSession
focal_class.modifiers: @Override public
focal_class.parameters: (final Session session)
focal_class.return: void
focal_class.signature: void setSession(final Session session)
focal_class.class_method_signature: DefaultSlingSimulator.setPackageManager(final JcrPackageManager packageManager)
focal_class.full_signature: @Override public void setPackageManager(final JcrPackageManager packageManager)
focal_class.identifier: setPackageManager
focal_class.modifiers: @Override public
focal_class.parameters: (final JcrPackageManager packageManager)
focal_class.return: void
focal_class.signature: void setPackageManager(final JcrPackageManager packageManager)
focal_class.class_method_signature: DefaultSlingSimulator.setErrorListener(final ErrorListener errorListener)
focal_class.full_signature: @Override public void setErrorListener(final ErrorListener errorListener)
focal_class.identifier: setErrorListener
focal_class.modifiers: @Override public
focal_class.parameters: (final ErrorListener errorListener)
focal_class.return: void
focal_class.signature: void setErrorListener(final ErrorListener errorListener)
focal_class.class_method_signature: DefaultSlingSimulator.dequeueInstallable()
focal_class.full_signature: @Override public @Nullable SlingInstallable dequeueInstallable()
focal_class.identifier: dequeueInstallable
focal_class.modifiers: @Override public @Nullable
focal_class.parameters: ()
focal_class.return: SlingInstallable
focal_class.signature: SlingInstallable dequeueInstallable()
focal_class.class_method_signature: DefaultSlingSimulator.open(@NotNull final SlingOpenable<ResourceType> installable)
focal_class.full_signature: @SuppressWarnings("unchecked") @Override public @NotNull Fun.ThrowingSupplier<ResourceType> open(@NotNull final SlingOpenable<ResourceType> installable)
focal_class.identifier: open
focal_class.modifiers: @SuppressWarnings("unchecked") @Override public @NotNull
focal_class.parameters: (@NotNull final SlingOpenable<ResourceType> installable)
focal_class.return: Fun.ThrowingSupplier<ResourceType>
focal_class.signature: Fun.ThrowingSupplier<ResourceType> open(@NotNull final SlingOpenable<ResourceType> installable)
focal_class.class_method_signature: DefaultSlingSimulator.openEmbeddedPackage(@NotNull final EmbeddedPackageInstallable installable)
focal_class.full_signature: public @NotNull JcrPackage openEmbeddedPackage(@NotNull final EmbeddedPackageInstallable installable)
focal_class.identifier: openEmbeddedPackage
focal_class.modifiers: public @NotNull
focal_class.parameters: (@NotNull final EmbeddedPackageInstallable installable)
focal_class.return: JcrPackage
focal_class.signature: JcrPackage openEmbeddedPackage(@NotNull final EmbeddedPackageInstallable installable)
focal_class.class_method_signature: DefaultSlingSimulator.createInstallableOrReport(final @NotNull SlingInstallableParams<T> params,
                                                                         final @NotNull PackageId parentPackageId,
                                                                         final @NotNull String jcrPath)
focal_class.full_signature:  Optional<T> createInstallableOrReport(final @NotNull SlingInstallableParams<T> params,
                                                                         final @NotNull PackageId parentPackageId,
                                                                         final @NotNull String jcrPath)
focal_class.identifier: createInstallableOrReport
focal_class.parameters: (final @NotNull SlingInstallableParams<T> params,
                                                                         final @NotNull PackageId parentPackageId,
                                                                         final @NotNull String jcrPath)
focal_class.return: Optional<T>
focal_class.signature: Optional<T> createInstallableOrReport(final @NotNull SlingInstallableParams<T> params,
                                                                         final @NotNull PackageId parentPackageId,
                                                                         final @NotNull String jcrPath)
focal_class.class_method_signature: DefaultSlingSimulator.internalAddInstallable(final @NotNull SlingInstallable installable)
focal_class.full_signature:  void internalAddInstallable(final @NotNull SlingInstallable installable)
focal_class.identifier: internalAddInstallable
focal_class.parameters: (final @NotNull SlingInstallable installable)
focal_class.return: void
focal_class.signature: void internalAddInstallable(final @NotNull SlingInstallable installable)
focal_class.class_method_signature: DefaultSlingSimulator.addInstallableNode(final @NotNull PackageId parentPackageId,
                                                           final @NotNull Node node)
focal_class.full_signature: @Override public @Nullable SlingInstallable addInstallableNode(final @NotNull PackageId parentPackageId,
                                                           final @NotNull Node node)
focal_class.identifier: addInstallableNode
focal_class.modifiers: @Override public @Nullable
focal_class.parameters: (final @NotNull PackageId parentPackageId,
                                                           final @NotNull Node node)
focal_class.return: SlingInstallable
focal_class.signature: SlingInstallable addInstallableNode(final @NotNull PackageId parentPackageId,
                                                           final @NotNull Node node)
focal_class.class_method_signature: DefaultSlingSimulator.getInstallables()
focal_class.full_signature:  LinkedList<SlingInstallable> getInstallables()
focal_class.identifier: getInstallables
focal_class.parameters: ()
focal_class.return: LinkedList<SlingInstallable>
focal_class.signature: LinkedList<SlingInstallable> getInstallables()
focal_class.class_method_signature: DefaultSlingSimulator.shufflePackagesByDependency()
focal_class.full_signature:  void shufflePackagesByDependency()
focal_class.identifier: shufflePackagesByDependency
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void shufflePackagesByDependency()
focal_class.class_method_signature: DefaultSlingSimulator.readInstallableParamsFromNode(final @NotNull Node node)
focal_class.full_signature: @NotNull Result<Optional<SlingInstallableParams<?>>> readInstallableParamsFromNode(final @NotNull Node node)
focal_class.identifier: readInstallableParamsFromNode
focal_class.modifiers: @NotNull
focal_class.parameters: (final @NotNull Node node)
focal_class.return: Result<Optional<SlingInstallableParams<?>>>
focal_class.signature: Result<Optional<SlingInstallableParams<?>>> readInstallableParamsFromNode(final @NotNull Node node)
focal_class.class_method_signature: DefaultSlingSimulator.maybePackageResource(final @NotNull NodeRes nodeRes)
focal_class.full_signature: @Nullable EmbeddedPackageInstallableParams maybePackageResource(final @NotNull NodeRes nodeRes)
focal_class.identifier: maybePackageResource
focal_class.modifiers: @Nullable
focal_class.parameters: (final @NotNull NodeRes nodeRes)
focal_class.return: EmbeddedPackageInstallableParams
focal_class.signature: EmbeddedPackageInstallableParams maybePackageResource(final @NotNull NodeRes nodeRes)
focal_class.class_method_signature: DefaultSlingSimulator.separatorsToUnix(final String path)
focal_class.full_signature: static String separatorsToUnix(final String path)
focal_class.identifier: separatorsToUnix
focal_class.modifiers: static
focal_class.parameters: (final String path)
focal_class.return: String
focal_class.signature: String separatorsToUnix(final String path)
focal_class.class_method_signature: DefaultSlingSimulator.getResourceId(final String rawUrl)
focal_class.full_signature: static String getResourceId(final String rawUrl)
focal_class.identifier: getResourceId
focal_class.modifiers: static
focal_class.parameters: (final String rawUrl)
focal_class.return: String
focal_class.signature: String getResourceId(final String rawUrl)
focal_class.class_method_signature: DefaultSlingSimulator.removeConfigExtension(final String id)
focal_class.full_signature: static String removeConfigExtension(final String id)
focal_class.identifier: removeConfigExtension
focal_class.modifiers: static
focal_class.parameters: (final String id)
focal_class.return: String
focal_class.signature: String removeConfigExtension(final String id)
focal_class.class_method_signature: DefaultSlingSimulator.isConfigExtension(String url)
focal_class.full_signature: static boolean isConfigExtension(String url)
focal_class.identifier: isConfigExtension
focal_class.modifiers: static
focal_class.parameters: (String url)
focal_class.return: boolean
focal_class.signature: boolean isConfigExtension(String url)
focal_class.class_method_signature: DefaultSlingSimulator.readDictionary(
              final InputStream is, final String id)
focal_class.full_signature: static Map<String, Object> readDictionary(
              final InputStream is, final String id)
focal_class.identifier: readDictionary
focal_class.modifiers: static
focal_class.parameters: (
              final InputStream is, final String id)
focal_class.return: Map<String, Object>
focal_class.signature: Map<String, Object> readDictionary(
              final InputStream is, final String id)
focal_class.class_method_signature: DefaultSlingSimulator.maybeConfigResource(final @NotNull NodeRes resource)
focal_class.full_signature: static @Nullable OsgiConfigInstallableParams maybeConfigResource(final @NotNull NodeRes resource)
focal_class.identifier: maybeConfigResource
focal_class.modifiers: static @Nullable
focal_class.parameters: (final @NotNull NodeRes resource)
focal_class.return: OsgiConfigInstallableParams
focal_class.signature: OsgiConfigInstallableParams maybeConfigResource(final @NotNull NodeRes resource)
focal_class.class_method_signature: DefaultSlingSimulator.loadJcrProperties(final @NotNull Map<String, Object> configMap, final @NotNull Node configNode)
focal_class.full_signature: static void loadJcrProperties(final @NotNull Map<String, Object> configMap, final @NotNull Node configNode)
focal_class.identifier: loadJcrProperties
focal_class.modifiers: static
focal_class.parameters: (final @NotNull Map<String, Object> configMap, final @NotNull Node configNode)
focal_class.return: void
focal_class.signature: void loadJcrProperties(final @NotNull Map<String, Object> configMap, final @NotNull Node configNode)
focal_class.class_method_signature: DefaultSlingSimulator.convertJcrValue(final @NotNull Value value)
focal_class.full_signature: static @Nullable Object convertJcrValue(final @NotNull Value value)
focal_class.identifier: convertJcrValue
focal_class.modifiers: static @Nullable
focal_class.parameters: (final @NotNull Value value)
focal_class.return: Object
focal_class.signature: Object convertJcrValue(final @NotNull Value value)
focal_method.body: static Map<String, Object> readDictionary(
              final InputStream is, final String id) throws IOException {
          final Map<String, Object> ht = new LinkedHashMap<>();
          if (id.endsWith(".cfg.json")) {
              final String name = "jcrinstall:".concat(id);
              String configId;
              int pos = id.lastIndexOf('/');
              if (pos == -1) {
                  configId = id;
              } else {
                  configId = id.substring(pos + 1);
              }
              pos = configId.indexOf('-');
              if (pos != -1) {
                  configId = configId.substring(0, pos).concat("~").concat(configId.substring(pos + 1));
              }
              configId = removeConfigExtension(configId);
  
              // read from input stream
              try (final Reader reader = new InputStreamReader(is, StandardCharsets.UTF_8)) {
                  final Dictionary<String, Object> config = Configurations.buildReader()
                          .withIdentifier(configId).build(reader).readConfiguration();
  
                  final Enumeration<String> i = config.keys();
                  while (i.hasMoreElements()) {
                      final String key = i.nextElement();
                      ht.put(key, config.get(key));
                  }
              }
          } else {
              try (final BufferedInputStream in = new BufferedInputStream(is)) {
  
                  if (id.endsWith(".config")) {
                      // check for initial comment line
                      in.mark(256);
                      final int firstChar = in.read();
                      if (firstChar == '#') {
                          int b;
                          while ((b = in.read()) != '\n') {
                              if (b == -1) {
                                  throw new IOException("Unable to read configuration.");
                              }
                          }
                      } else {
                          in.reset();
                      }
                      @SuppressWarnings("unchecked") final Dictionary<String, Object> config = ConfigurationHandler.read(in);
                      final Enumeration<String> i = config.keys();
                      while (i.hasMoreElements()) {
                          final String key = i.nextElement();
                          ht.put(key, config.get(key));
                      }
                  } else {
                      final Properties p = new Properties();
                      in.mark(1);
                      boolean isXml = in.read() == '<';
                      in.reset();
                      if (isXml) {
                          p.loadFromXML(in);
                      } else {
                          p.load(in);
                      }
                      final Enumeration<Object> i = p.keys();
                      while (i.hasMoreElements()) {
                          final Object key = i.nextElement();
                          ht.put(key.toString(), p.get(key));
                      }
                  }
              }
          }
          return ht;
      }
focal_method.class_method_signature: DefaultSlingSimulator.readDictionary(
              final InputStream is, final String id)
focal_method.full_signature: static Map<String, Object> readDictionary(
              final InputStream is, final String id)
focal_method.identifier: readDictionary
focal_method.invocations: endsWith concat lastIndexOf substring indexOf concat concat substring substring removeConfigExtension readConfiguration build withIdentifier buildReader keys hasMoreElements nextElement put get endsWith mark read read reset read keys hasMoreElements nextElement put get mark read reset loadFromXML load keys hasMoreElements nextElement put toString get
focal_method.modifiers: static
focal_method.parameters: (
              final InputStream is, final String id)
focal_method.return: Map<String, Object>
focal_method.signature: Map<String, Object> readDictionary(
              final InputStream is, final String id)