karaf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sylvain RIBEYRON (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (KARAF-2647) make eik compatible with Karaf 3.x
Date Mon, 17 Feb 2014 18:32:20 GMT

    [ https://issues.apache.org/jira/browse/KARAF-2647?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13903425#comment-13903425
] 

Sylvain RIBEYRON edited comment on KARAF-2647 at 2/17/14 6:31 PM:
------------------------------------------------------------------

Hello.

I've made a patch to enable Karaf to run in EIK. Here is a summary of what I've done. Most
of changes are needed because of changes in Karaf configuration files:

------------------------------------------------------
In config.properties, a new "karaf.etc" interpolation variable is needed. As a result, we
need to add it in EIK as it is already done with "karaf.home" variable:

In org.apache.karaf.eik.core.IKarafConstants, add:
public static final String KARAF_ETC_PROP = "karaf.etc";

In org.apache.karaf.eik.ui.workbench.internal.GenericKarafWorkbenchService.createLaunchSystemProperties()
At line 444: add the following code:

systemProperties.put(
            IKarafConstants.KARAF_ETC_PROP, *** path to etc dir ***);


In org.apache.karaf.eik.ui.project.KarafProjectBuilder.buildRuntimeProperties():


At line 196, add:
combinedProperties.put("karaf.etc", *** path to etc dir ***);

In org.apache.karaf.eik.ui.project.impl.KarafRuntimePropertyBuildUnit.build()

At line 52, add:
combinedProperties.put("karaf.etc", *** path to etc dir ***);

----------------------------------------------------
In mvn config file, org.ops4j.pax.url.mvn.defaultRepositories is not defined. This causes
a npe.

org.apache.karaf.eik.ui.features.FeaturesResolverJob.resolveFeatures()
At line 121, replace line of code by:
                    ArrayList<String> reposList = new ArrayList<String>();
                    if (defaultRepos != null)
                        reposList.add(defaultRepos);
                    if (repos != null)
                        reposList.add(repos);
                    final String combinedRepos = KarafCorePluginUtils.join(reposList, ",");
                    mvnConfiguration.put("org.ops4j.pax.url.mvn.repositories", removeInvalidSuffixes(combinedRepos));


----------------------------------------------------------------
In startup.properties, bundles are now referenced by URL, not by local path. As a result,
EIK cannot match bundled when populating bundles to run at startup.

In org.apache.karaf.eik.core.configuration.internal.StartupSectionImpl, add a method:

    /**
     * Converts a MVN url to a file path, relative to System.
     * Code taken from MvnUrlConverter from UI plugin.
     * TODO: move class MvnUrlConverter inside core plugin and use it
     * as dependency from UI plugin.
     */
    protected String getPath(String url) {
        if (url != null) {
            if (url.startsWith("mvn:")) {
                url = url.substring(4);
                String[] repositorySplit = url.split("!");
                String urlWithoutRepository = repositorySplit[repositorySplit.length - 1];

                String[] segments = urlWithoutRepository.split("/");
                if (segments.length >= 3) {
                    String groupId = segments[0];
                    String artifactId = segments[1];
                    String version = segments[2];

                    return groupId.replace(".", "/") + "/" + artifactId + "/" + version +
"/" + artifactId + "-" + version + ".jar";
                }
            }
        }

        return url;
    }


In org.apache.karaf.eik.core.configuration.internal.StartupSectionImpl.populateStartupStateModel()
first translate "o" object from URL to path:

            final File bundleLocation = new File(rootBundleDir, getPath((String) o));

-------------------------------------------------------------

Thanks a lot for your great job on Apache Karaf and EIK !

Regards,
Sylvain RIBEYRON.



was (Author: sribeyron):
Hello.

I've made a patch to enable Karaf to run in EIK. Here is a summary of what I've done. Most
of changes are needed because of changes in Karaf configuration files:

------------------------------------------------------
In config.properties, a new "karaf.etc" interpolation variable is needed. As a result, we
need to add it in EIK as it is already done with "karaf.home" variable:

In org.apache.karaf.eik.core.IKarafConstants, add:
public static final String KARAF_ETC_PROP = "karaf.etc";

org.apache.karaf.eik.ui.workbench.internal.GenericKarafWorkbenchService.createLaunchSystemProperties()
At line 444: add the following code:

systemProperties.put(
            IKarafConstants.KARAF_ETC_PROP,
            *** path to etc dir ***);


In org.apache.karaf.eik.ui.project.KarafProjectBuilder.buildRuntimeProperties():


At line 196, add:
combinedProperties.put("karaf.etc", *** path to etc dir ***);

In org.apache.karaf.eik.ui.project.impl.KarafRuntimePropertyBuildUnit.build()

At line 52, add:
combinedProperties.put("karaf.etc", *** path to etc dir ***);

----------------------------------------------------
In mvn config file, org.ops4j.pax.url.mvn.defaultRepositories is not defined. This causes
a npe.

org.apache.karaf.eik.ui.features.FeaturesResolverJob.resolveFeatures()
At line 121, replace line of code by:
                    ArrayList<String> reposList = new ArrayList<String>();
                    if (defaultRepos != null)
                        reposList.add(defaultRepos);
                    if (repos != null)
                        reposList.add(repos);
                    final String combinedRepos = KarafCorePluginUtils.join(reposList, ",");
                    mvnConfiguration.put("org.ops4j.pax.url.mvn.repositories", removeInvalidSuffixes(combinedRepos));


----------------------------------------------------------------
In startup.properties, bundles are now referenced by URL, not by local path. As a result,
EIK cannot match bundled when populating bundles to run at startup.

In org.apache.karaf.eik.core.configuration.internal.StartupSectionImpl, add a method:

    /**
     * Converts a MVN url to a file path, relative to System.
     * Code taken from MvnUrlConverter from UI plugin.
     * TODO: move class MvnUrlConverter inside core plugin and use it
     * as dependency from UI plugin.
     */
    protected String getPath(String url) {
        if (url != null) {
            if (url.startsWith("mvn:")) {
                url = url.substring(4);
                String[] repositorySplit = url.split("!");
                String urlWithoutRepository = repositorySplit[repositorySplit.length - 1];

                String[] segments = urlWithoutRepository.split("/");
                if (segments.length >= 3) {
                    String groupId = segments[0];
                    String artifactId = segments[1];
                    String version = segments[2];

                    return groupId.replace(".", "/") + "/" + artifactId + "/" + version +
"/" + artifactId + "-" + version + ".jar";
                }
            }
        }

        return url;
    }


In org.apache.karaf.eik.core.configuration.internal.StartupSectionImpl.populateStartupStateModel()
first translate "o" object from URL to path:

            final File bundleLocation = new File(rootBundleDir, getPath((String) o));

-------------------------------------------------------------

Thanks a lot for your great job on Apache Karaf and EIK !

Regards,
Sylvain RIBEYRON.


> make eik compatible with Karaf 3.x
> ----------------------------------
>
>                 Key: KARAF-2647
>                 URL: https://issues.apache.org/jira/browse/KARAF-2647
>             Project: Karaf
>          Issue Type: Task
>            Reporter: filippo balicchia
>            Assignee: filippo balicchia
>            Priority: Minor
>         Attachments: patch.txt
>
>




--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Mime
View raw message