/**
  * @param propertyName the name of the property key
  * @param defaultValue the default value to return if no configured property is found or {@link
  *     ConfigProperty#NULL} if no default value should be returned.
  * @return the configured value or the defaultValue according to the NULL logic.
  */
 protected String getPropertyValue(String propertyName, String defaultValue) {
   String configuredValue;
   if (ConfigProperty.NULL.equals(defaultValue)) {
     // no special defaultValue has been configured
     configuredValue = ConfigResolver.getPropertyValue(propertyName);
   } else {
     configuredValue = ConfigResolver.getPropertyValue(propertyName, defaultValue);
   }
   return configuredValue;
 }
 private void ensureInstance() throws IOException {
   if (instance == null) { // can already be initialized when called from ContextualStorage
     instance =
         Hazelcast.getHazelcastInstanceByName(
             ConfigResolver.getPropertyValue(
                 ClusterScopeExtension.class.getName() + ".hazelcast-instance",
                 "cluster-scope-instance"));
     if (instance == null) {
       final String hazelcastXml =
           ConfigResolver.getPropertyValue(
               ClusterScopeExtension.class.getName() + ".hazelcast-xml");
       instance =
           hazelcastXml == null
               ? Hazelcast.newHazelcastInstance()
               : Hazelcast.newHazelcastInstance(new UrlXmlConfig(hazelcastXml));
     }
   }
 }
  @PostConstruct
  private void init() {
    workDir =
        Optional.ofNullable(repository.findBy(Keys.WORK_DIR))
            .map(Property::getValue)
            .orElse(
                Optional.of(new File(System.getProperty("openejb.base", "."), "work"))
                    .filter(File::isDirectory)
                    .map(
                        f -> {
                          final File dir = new File(f, "tribe-cron.");
                          dir.mkdirs();
                          return f;
                        })
                    .map(File::getAbsolutePath)
                    .orElse(System.getProperty("java.io.tmpdir")));

    ConfigResolver.addConfigSources(singletonList(this));
  }
 void addClusterScope(final @Observes AfterBeanDiscovery afb, final BeanManager bm) {
   mapName =
       ConfigResolver.getPropertyValue(
           ClusterScopeExtension.class.getName() + ".hazelcast-ref", "cluster-scope-map");
   afb.addContext(new ClusterContext());
 }