+ /**
+ * Override this method to provide more options to config.
+ *
+ * @return An array of additional config options
+ */
+ protected Option[] getAdditionalOptions() {
+ return null;
+ }
+
+ /**
+ * Returns a Log4J logging configuration property name for the given class's package name of the form
+ * "log4j.logger.package_name".
+ *
+ * @deprecated The karaf logging provider is now Log4J2 so logging configurations must conform to the Log4J2 style.
+ * This method is kept for compilation backwards compatibility but will be removed in a future release.
+ */
+ @Deprecated
+ public String logConfiguration(final Class<?> klazz) {
+ return "log4j.logger." + klazz.getPackage().getName();
+ }
+
+ public String getKarafDistro() {
+ String groupId = System.getProperty(KARAF_DISTRO_GROUPID_PROP, KARAF_DISTRO_GROUPID);
+ String artifactId = System.getProperty(KARAF_DISTRO_ARTIFACTID_PROP, KARAF_DISTRO_ARTIFACTID);
+ String type = System.getProperty(KARAF_DISTRO_TYPE_PROP, KARAF_DISTRO_TYPE);
+
+ return maven().groupId(groupId).artifactId(artifactId).versionAsInProject().type(type).getURL();
+ }
+
+ protected Option mvnLocalRepoOption() {
+ String mvnRepoLocal = System.getProperty(MAVEN_REPO_LOCAL, "");
+ LOG.info("mvnLocalRepo \"{}\"", mvnRepoLocal);
+ return editConfigurationFilePut(ETC_ORG_OPS4J_PAX_URL_MVN_CFG, ORG_OPS4J_PAX_URL_MVN_LOCAL_REPOSITORY,
+ mvnRepoLocal);
+ }
+
+ @Configuration
+ public Option[] config() {
+ Option[] options = new Option[] {
+ when(Boolean.getBoolean(KARAF_DEBUG_PROP))
+ .useOptions(KarafDistributionOption.debugConfiguration(KARAF_DEBUG_PORT, true)),
+ karafDistributionConfiguration().frameworkUrl(getKarafDistro())
+ .unpackDirectory(new File(PAX_EXAM_UNPACK_DIRECTORY)).useDeployFolder(false),
+ when(Boolean.getBoolean(KEEP_UNPACK_DIRECTORY_PROP)).useOptions(keepRuntimeFolder()),
+ features(getFeatureRepo(), getFeatureName()),
+ //mavenBundle("org.apache.aries.quiesce", "org.apache.aries.quiesce.api", "1.0.0"), getLoggingOption(),
+ mvnLocalRepoOption(),
+ configureConsole().ignoreLocalConsole().ignoreRemoteShell(),
+ editConfigurationFilePut(ETC_ORG_OPS4J_PAX_LOGGING_CFG, "log4j2.rootLogger.level", "INFO") };
+ return OptionUtils.combine(options, getAdditionalOptions());
+ }