Skip to content

Commit

Permalink
Refactor plugins - Create Core and UI plugins for base and LSP functi…
Browse files Browse the repository at this point in the history
…onality. Fixes fabric8-analytics#143

Signed-off-by: Rastislav Wagner <[email protected]>
  • Loading branch information
rawagner committed Apr 12, 2018
1 parent 6fb8ca3 commit e74ebe8
Show file tree
Hide file tree
Showing 98 changed files with 1,339 additions and 441 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
###############################################################################
# Copyright (c) 2017 Red Hat, Inc. and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
# Red Hat, Inc. - Initial implementation.
##############################################################################
# feature.properties
# contains externalized strings for feature.xml
# "%foo" in feature.xml corresponds to the key "foo" in this file
# java.io.Properties file (ISO 8859-1 with "\" escapes)
# This file should be translated.

# "featureName" property - name of the feature
featureName=Fabric8Analytics Integration (Technology Preview)

# "providerName" property - name of the company that provides the feature
providerName=JBoss by Red Hat

# "description" property - description of the feature
description=Fabric8Analytics Integration Feature (Technology Preview)

# "copyright" property - text of the "Feature Update Copyright"
copyright=Copyright (c) 2017 Red Hat, Inc. and others.\nAll rights reserved. This program and the accompanying materials\n
are made available under the terms of the Eclipse Public License v1.0\n\
which accompanies this distribution, and is available at\n\
http\://www.eclipse.org/legal/epl-v10.html\n\
\n\
Contributors\:\n\
Red Hat, Inc. - Initial implementation.\n
############### end of copyright property ####################################

licenseURL=license.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="com.redhat.fabric8analytics.lsp.eclipse.feature"
id="com.redhat.fabric8analytics.eclipse.feature"
label="%featureName"
version="0.0.1.qualifier"
provider-name="%providerName"
license-feature="org.jboss.tools.foundation.license.feature"
license-feature-version="0.0.0"
plugin="com.redhat.fabric8analytics.lsp.eclipse">
plugin="com.redhat.fabric8analytics.eclipse">

<description url="https://access.redhat.com/documentation/en/red-hat-jboss-developer-studio/">
%description
Expand All @@ -20,7 +20,7 @@
%license
</license>

<plugin id="com.redhat.fabric8analytics.lsp.eclipse.core" download-size="0" install-size="0" version="0.0.0"/>
<plugin id="com.redhat.fabric8analytics.lsp.eclipse.ui" download-size="0" install-size="0" version="0.0.0"/>
<plugin id="com.redhat.fabric8analytics.eclipse.core" download-size="0" install-size="0" version="0.0.0"/>
<plugin id="com.redhat.fabric8analytics.eclipse.ui" download-size="0" install-size="0" version="0.0.0"/>

</feature>
53 changes: 53 additions & 0 deletions features/com.redhat.fabric8analytics.eclipse.feature/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.redhat.fabric8analytics.eclipse</groupId>
<artifactId>features</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<groupId>com.redhat.fabric8analytics.eclipse</groupId>
<artifactId>com.redhat.fabric8analytics.eclipse.feature</artifactId>
<packaging>eclipse-feature</packaging>

<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho.extras</groupId>
<artifactId>tycho-source-feature-plugin</artifactId>
<version>${tychoExtrasVersion}</version>
<executions>
<execution>
<id>source-feature</id>
<phase>package</phase>
<goals>
<goal>source-feature</goal>
</goals>
</execution>
</executions>
<!-- optional excludes -->
<!-- <configuration>
<excludes>
<plugin id="sourcefeature.bundle.nosource"/>
<feature id="sourcefeature.feature.nosource"/>
</excludes>
</configuration>
--> </plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-p2-plugin</artifactId>
<version>${tychoVersion}</version>
<executions>
<execution>
<id>attached-p2-metadata</id>
<phase>package</phase>
<goals>
<goal>p2-metadata</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/bin/
/.settings/
/.project
/.classpath
target/
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
bin.includes = feature.xml,\
feature.properties
src.includes = feature.xml,\
feature.properties,\
build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="com.redhat.fabric8analytics.eclipse.lsp.feature"
label="%featureName"
version="0.0.1.qualifier"
provider-name="%providerName"
license-feature="org.jboss.tools.foundation.license.feature"
license-feature-version="0.0.0"
plugin="com.redhat.fabric8analytics.eclipse.lsp">

<description url="https://access.redhat.com/documentation/en/red-hat-jboss-developer-studio/">
%description
</description>

<copyright>
%copyright
</copyright>

<license url="%licenseURL">
%license
</license>

<plugin id="com.redhat.fabric8analytics.eclipse.core" download-size="0" install-size="0" version="0.0.0"/>
<plugin id="com.redhat.fabric8analytics.eclipse.ui" download-size="0" install-size="0" version="0.0.0"/>
<plugin id="com.redhat.fabric8analytics.eclipse.lsp.core" download-size="0" install-size="0" version="0.0.0"/>
<plugin id="com.redhat.fabric8analytics.eclipse.lsp.ui" download-size="0" install-size="0" version="0.0.0"/>

</feature>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<version>0.0.1-SNAPSHOT</version>
</parent>
<groupId>com.redhat.fabric8analytics.eclipse</groupId>
<artifactId>com.redhat.fabric8analytics.lsp.eclipse.feature</artifactId>
<artifactId>com.redhat.fabric8analytics.eclipse.lsp.feature</artifactId>
<packaging>eclipse-feature</packaging>

<build>
Expand Down
Empty file.
4 changes: 2 additions & 2 deletions features/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
<artifactId>com.redhat.fabric8analytics.parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<groupId>com.redhat.fabric8analytics.eclipse</groupId>
<artifactId>features</artifactId>

<name>com.redhat.fabric8analytics.eclipse features</name>
<packaging>pom</packaging>
<modules>
<module>com.redhat.fabric8analytics.lsp.eclipse.feature</module>
<module>com.redhat.fabric8analytics.eclipse.feature</module>
<module>com.redhat.fabric8analytics.eclipse.lsp.feature</module>
</modules>
</project>
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.redhat.fabric8analytics.lsp.eclipse.core;singleton:=true
Bundle-SymbolicName: com.redhat.fabric8analytics.eclipse.core;singleton:=true
Bundle-Version: 0.0.1.qualifier
Bundle-Vendor: %Bundle-Vendor
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: org.eclipse.lsp4e;bundle-version="0.3.0",
org.eclipse.core.runtime,
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.resources;bundle-version="3.12.0",
org.apache.httpcomponents.httpclient;bundle-version="4.5.2",
org.apache.httpcomponents.httpcore;bundle-version="4.4.6",
Expand All @@ -18,13 +17,13 @@ Require-Bundle: org.eclipse.lsp4e;bundle-version="0.3.0",
org.eclipse.m2e.core,
org.eclipse.m2e.maven.runtime,
org.jboss.tools.openshift.io.core
Eclipse-BundleShape: dir
Bundle-Activator: com.redhat.fabric8analytics.lsp.eclipse.core.Fabric8AnalysisLSCoreActivator
Bundle-Activator: com.redhat.fabric8analytics.eclipse.core.Fabric8AnalysisCoreActivator
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
Export-Package: com.redhat.fabric8analytics.lsp.eclipse.core,
com.redhat.fabric8analytics.lsp.eclipse.core.job,
com.redhat.fabric8analytics.lsp.eclipse.core.data,
com.redhat.fabric8analytics.lsp.eclipse.core.internal;x-friends:=com.redhat.fabric8analytics.lsp.eclipse.ui
Export-Package: com.redhat.fabric8analytics.eclipse.core,
com.redhat.fabric8analytics.eclipse.core.data,
com.redhat.fabric8analytics.eclipse.core.internal;x-friends:="com.redhat.fabric8analytics.eclipse.lsp.core, com.redhat.fabric8analytics.eclipse.ui, com.redhat.fabric8analytics.eclipse.lsp.ui",
com.redhat.fabric8analytics.eclipse.core.job,
com.redhat.fabric8analytics.eclipse.core.api


Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Bundle-Name=Fabric8Analytics Core Plugin
Bundle-Vendor=JBoss by Red Hat
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<version>0.0.1-SNAPSHOT</version>
</parent>

<artifactId>com.redhat.fabric8analytics.lsp.eclipse.core</artifactId>
<artifactId>com.redhat.fabric8analytics.eclipse.core</artifactId>
<packaging>eclipse-plugin</packaging>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Red Hat Incorporated - initial API and implementation
*******************************************************************************/

package com.redhat.fabric8analytics.lsp.eclipse.core;
package com.redhat.fabric8analytics.eclipse.core;

import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Plugin;
Expand All @@ -19,17 +19,17 @@
/**
* The activator class controls the plug-in life cycle
*/
public class Fabric8AnalysisLSCoreActivator extends Plugin {
public class Fabric8AnalysisCoreActivator extends Plugin {

public static final String PLUGIN_ID = "com.redhat.fabric8analytics.lsp.eclipse.core";
public static final String PLUGIN_ID = "com.redhat.fabric8analytics.eclipse.core";

// The shared instance
private static Fabric8AnalysisLSCoreActivator plugin;
private static Fabric8AnalysisCoreActivator plugin;

/**
* The constructor
*/
public Fabric8AnalysisLSCoreActivator() {
public Fabric8AnalysisCoreActivator() {
}

@Override
Expand All @@ -49,7 +49,7 @@ public void stop(BundleContext context) throws Exception {
*
* @return the shared instance
*/
public static Fabric8AnalysisLSCoreActivator getDefault() {
public static Fabric8AnalysisCoreActivator getDefault() {
return plugin;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,17 @@
* Contributors:
* Red Hat Incorporated - initial API and implementation
*******************************************************************************/
package com.redhat.fabric8analytics.lsp.eclipse.core;
package com.redhat.fabric8analytics.eclipse.core;

import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.equinox.security.storage.ISecurePreferences;
import org.eclipse.equinox.security.storage.SecurePreferencesFactory;
import org.eclipse.equinox.security.storage.StorageException;

import com.redhat.fabric8analytics.lsp.eclipse.core.data.ThreeScaleData;
import com.redhat.fabric8analytics.eclipse.core.data.ThreeScaleData;

public class Fabric8AnalysisPreferences {

public static final String LSP_SERVER_ENABLED = "fabric8AnalysisPreferences.LSP_ENABLED";
public static final String PROD_URL = "fabric8AnalysisPreferences.PROD_URL";
public static final String STAGE_URL = "fabric8AnalysisPreferences.STAGE_URL";
public static final String USER_KEY = "fabric8AnalysisPreferences.USER_KEY";
Expand All @@ -39,28 +38,20 @@ public static Fabric8AnalysisPreferences getInstance() {
return instance;
}

public boolean isLSPServerEnabled() {
return InstanceScope.INSTANCE.getNode(Fabric8AnalysisLSCoreActivator.PLUGIN_ID).getBoolean(LSP_SERVER_ENABLED, false);
}

public void setLSPServerEnabled(boolean enabled) {
InstanceScope.INSTANCE.getNode(Fabric8AnalysisLSCoreActivator.PLUGIN_ID).putBoolean(LSP_SERVER_ENABLED, enabled);
}

public String getProdURL() {
return InstanceScope.INSTANCE.getNode(Fabric8AnalysisLSCoreActivator.PLUGIN_ID).get(PROD_URL, null);
return InstanceScope.INSTANCE.getNode(Fabric8AnalysisCoreActivator.PLUGIN_ID).get(PROD_URL, null);
}

public void setProdURL(String prodURL) {
InstanceScope.INSTANCE.getNode(Fabric8AnalysisLSCoreActivator.PLUGIN_ID).put(PROD_URL, prodURL);
InstanceScope.INSTANCE.getNode(Fabric8AnalysisCoreActivator.PLUGIN_ID).put(PROD_URL, prodURL);
}

public String getStageURL() {
return InstanceScope.INSTANCE.getNode(Fabric8AnalysisLSCoreActivator.PLUGIN_ID).get(STAGE_URL, null);
return InstanceScope.INSTANCE.getNode(Fabric8AnalysisCoreActivator.PLUGIN_ID).get(STAGE_URL, null);
}

public void setStageURL(String stageURL) {
InstanceScope.INSTANCE.getNode(Fabric8AnalysisLSCoreActivator.PLUGIN_ID).put(STAGE_URL, stageURL);
InstanceScope.INSTANCE.getNode(Fabric8AnalysisCoreActivator.PLUGIN_ID).put(STAGE_URL, stageURL);
}

public String getUserKey() throws StorageException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Red Hat Incorporated - initial API and implementation
*******************************************************************************/

package com.redhat.fabric8analytics.lsp.eclipse.core;
package com.redhat.fabric8analytics.eclipse.core.api;

import org.json.JSONObject;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Red Hat Incorporated - initial API and implementation
*******************************************************************************/

package com.redhat.fabric8analytics.lsp.eclipse.core;
package com.redhat.fabric8analytics.eclipse.core.api;


import java.io.File;
Expand All @@ -31,8 +31,9 @@
import org.json.JSONException;
import org.json.JSONObject;

import com.redhat.fabric8analytics.lsp.eclipse.core.data.AnalyticsAuthData;
import com.redhat.fabric8analytics.lsp.eclipse.core.internal.PomContentBody;
import com.redhat.fabric8analytics.eclipse.core.Fabric8AnalysisCoreActivator;
import com.redhat.fabric8analytics.eclipse.core.data.AnalyticsAuthData;
import com.redhat.fabric8analytics.eclipse.core.internal.PomContentBody;

/**
* Provides access to Recommender API server
Expand Down Expand Up @@ -132,7 +133,7 @@ public boolean analysesFinished(String jobId) throws RecommenderAPIException {
int responseCode = response.getStatusLine().getStatusCode();

// TODO - for debug purposes - should be removed later
Fabric8AnalysisLSCoreActivator.getDefault().logInfo("F8 server response code: " + responseCode);
Fabric8AnalysisCoreActivator.getDefault().logInfo("F8 server response code: " + responseCode);

if (responseCode == HttpStatus.SC_OK) {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Red Hat Incorporated - initial API and implementation
*******************************************************************************/

package com.redhat.fabric8analytics.lsp.eclipse.core;
package com.redhat.fabric8analytics.eclipse.core.api;

import org.json.JSONObject;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Red Hat Incorporated - initial API and implementation
*******************************************************************************/

package com.redhat.fabric8analytics.lsp.eclipse.core;
package com.redhat.fabric8analytics.eclipse.core.api;

import java.io.IOException;

Expand All @@ -22,7 +22,7 @@
import org.json.JSONException;
import org.json.JSONObject;

import com.redhat.fabric8analytics.lsp.eclipse.core.data.ThreeScaleData;
import com.redhat.fabric8analytics.eclipse.core.data.ThreeScaleData;

/**
* Provides access to 3scale service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Contributors:
* Red Hat Incorporated - initial API and implementation
*******************************************************************************/
package com.redhat.fabric8analytics.lsp.eclipse.core.data;
package com.redhat.fabric8analytics.eclipse.core.data;

public class AnalyticsAuthData {

Expand Down
Loading

0 comments on commit e74ebe8

Please sign in to comment.