Commit e9b06136 authored by Jay Jay Billings's avatar Jay Jay Billings
Browse files

Started adding OSGi remote services support for the Core.



Updated the target. Added properties map in the core. Updated the launch
configuration.
Signed-off-by: default avatarJay Jay Billings <billingsjj@ornl.gov>
parent 3b6d39ae
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Declipse.ignoreApp=true -Dosgi.noShutdown=true -Dorg.osgi.service.http.port=8082 -Dice.projectLocation=/home/bkj/ICEFiles -Dcom.sun.jersey.config.property.packages=org.eclipse.ice.core.iCore -Dorg.osgi.framework.bundle.parent=ext;"/> <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Declipse.ignoreApp=true -Dosgi.noShutdown=true -Dorg.osgi.service.http.port=8082 -Dice.projectLocation=/home/bkj/ICEFiles -Dcom.sun.jersey.config.property.packages=org.eclipse.ice.core.iCore -Dorg.osgi.framework.bundle.parent=ext;"/>
<stringAttribute key="pde.version" value="3.3"/> <stringAttribute key="pde.version" value="3.3"/>
<booleanAttribute key="show_selected_only" value="false"/> <booleanAttribute key="show_selected_only" value="false"/>
<stringAttribute key="target_bundles" value="bcpkix@default:default,bcprov@default:default,ca.odell.glazedlists@default:default,ch.qos.logback.classic@default:default,ch.qos.logback.core@default:default,ch.qos.logback.slf4j@default:false,com.google.gson@default:default,com.google.guava@default:default,com.google.inject.multibindings@default:false,com.google.inject@default:default,com.ibm.icu@default:default,com.jcraft.jsch@default:default,com.spotify.docker-client.shaded@default:default,com.sun.jersey@default:default,gov.lbnl.visit.swt@default:default,javax.activation@default:default,javax.el@default:default,javax.inject@default:default,javax.servlet.jsp@default:default,javax.servlet@default:default,javax.ws.rs@default:default,javax.xml@default:default,org.antlr.runtime*3.2.0.v201101311130@default:default,org.antlr.runtime*4.3.0.v201502022030@default:default,org.apache.ant@default:default,org.apache.batik.css*1.7.0.v201011041433@default:default,org.apache.batik.util*1.7.0.v201011041433@default:default,org.apache.batik.util.gui*1.7.0.v200903091627@default:default,org.apache.commons.beanutils@default:default,org.apache.commons.codec@default:default,org.apache.commons.collections@default:default,org.apache.commons.io@default:default,org.apache.commons.jxpath@default:default,org.apache.commons.logging*1.0.4.v201101211617@default:default,org.apache.commons.logging*1.1.1.v201101211721@default:default,org.apache.commons.math@default:default,org.apache.felix.gogo.command@default:default,org.apache.felix.gogo.runtime@default:default,org.apache.felix.gogo.shell@default:default,org.apache.httpcomponents.httpclient@default:default,org.apache.httpcomponents.httpcore@default:default,org.apache.lucene.analysis@default:default,org.apache.lucene.core@default:default,org.eclipse.ant.core@default:default,org.eclipse.cdt.core.linux.x86_64@default:false,org.eclipse.cdt.core.linux@default:false,org.eclipse.cdt.core.native@default:default,org.eclipse.compare.core@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.core.databinding@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.filebuffers@default:default,org.eclipse.core.filesystem.linux.x86_64@default:false,org.eclipse.core.filesystem@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.net.linux.x86_64@default:false,org.eclipse.core.net@default:default,org.eclipse.core.resources@default:default,org.eclipse.core.runtime@default:true,org.eclipse.core.variables@default:default,org.eclipse.debug.core@default:default,org.eclipse.draw2d@default:default,org.eclipse.e4.core.commands@default:default,org.eclipse.e4.core.contexts@default:default,org.eclipse.e4.core.di.annotations@default:default,org.eclipse.e4.core.di.extensions@default:default,org.eclipse.e4.core.di@default:default,org.eclipse.e4.core.services@default:default,org.eclipse.e4.emf.xpath@default:default,org.eclipse.e4.ui.bindings@default:default,org.eclipse.e4.ui.css.core@default:default,org.eclipse.e4.ui.css.swt.theme@default:default,org.eclipse.e4.ui.css.swt@default:default,org.eclipse.e4.ui.di@default:default,org.eclipse.e4.ui.model.workbench@default:default,org.eclipse.e4.ui.services@default:default,org.eclipse.e4.ui.swt.gtk@default:false,org.eclipse.e4.ui.widgets@default:default,org.eclipse.e4.ui.workbench.addons.swt@default:default,org.eclipse.e4.ui.workbench.renderers.swt@default:default,org.eclipse.e4.ui.workbench.swt@default:default,org.eclipse.e4.ui.workbench3@default:default,org.eclipse.e4.ui.workbench@default:default,org.eclipse.eavp.geometry.view.model@default:default,org.eclipse.eavp.viz.datastructures@default:default,org.eclipse.eavp.viz.modeling@default:default,org.eclipse.eavp.viz.service.mesh@default:default,org.eclipse.eavp.viz.service.visit@default:default,org.eclipse.eavp.viz.service@default:default,org.eclipse.eavp.viz@default:default,org.eclipse.emf.common@default:default,org.eclipse.emf.ecore.change@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.emf.ecore@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.bidi@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.console@default:default,org.eclipse.equinox.ds@default:true,org.eclipse.equinox.http.jetty@default:default,org.eclipse.equinox.http.registry@default:default,org.eclipse.equinox.http.servlet@default:default,org.eclipse.equinox.http.servletbridge@default:default,org.eclipse.equinox.p2.core@default:default,org.eclipse.equinox.p2.engine@default:default,org.eclipse.equinox.p2.metadata.repository@default:default,org.eclipse.equinox.p2.metadata@default:default,org.eclipse.equinox.p2.repository@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.region@default:false,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.security@default:default,org.eclipse.equinox.servletbridge@default:default,org.eclipse.equinox.transforms.hook@default:false,org.eclipse.equinox.util@default:default,org.eclipse.equinox.weaving.hook@default:false,org.eclipse.fx.osgi@default:false,org.eclipse.help.base@default:default,org.eclipse.help.ui@default:default,org.eclipse.help@default:default,org.eclipse.january.geometry.model@default:default,org.eclipse.january.geometry.xtext.obj@default:default,org.eclipse.jetty.http@default:default,org.eclipse.jetty.io@default:default,org.eclipse.jetty.security@default:default,org.eclipse.jetty.server@default:default,org.eclipse.jetty.servlet@default:default,org.eclipse.jetty.util@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.jface.text@default:default,org.eclipse.jface@default:default,org.eclipse.jsch.core@default:default,org.eclipse.nebula.visualization.widgets@default:default,org.eclipse.nebula.visualization.xygraph@default:default,org.eclipse.osgi.compatibility.state@default:false,org.eclipse.osgi.services@default:default,org.eclipse.osgi@-1:true,org.eclipse.platform@default:default,org.eclipse.remote.core@default:default,org.eclipse.remote.jsch.core@default:default,org.eclipse.remote.ui@default:default,org.eclipse.swt.gtk.linux.x86_64@default:false,org.eclipse.swt@default:default,org.eclipse.swtbot.ant.junit@default:false,org.eclipse.text@default:default,org.eclipse.ui.cheatsheets@default:default,org.eclipse.ui.console@default:default,org.eclipse.ui.editors@default:default,org.eclipse.ui.forms@default:default,org.eclipse.ui.ide@default:default,org.eclipse.ui.intro@default:default,org.eclipse.ui.navigator@default:default,org.eclipse.ui.trace@default:default,org.eclipse.ui.views.properties.tabbed@default:default,org.eclipse.ui.views@default:default,org.eclipse.ui.workbench.texteditor@default:default,org.eclipse.ui.workbench@default:default,org.eclipse.ui@default:default,org.eclipse.wst.jsdt.nashorn.extension@default:false,org.eclipse.xsd@default:default,org.eclipse.xtend.lib.macro@default:default,org.eclipse.xtend.lib@default:default,org.eclipse.xtext.smap@default:default,org.eclipse.xtext.util@default:default,org.eclipse.xtext.xbase.lib@default:default,org.eclipse.xtext@default:default,org.hamcrest.core@default:default,org.junit@default:default,org.objectweb.asm@default:default,org.slf4j.api@default:default,org.slf4j.impl.log4j12@default:false,org.slf4j.log4j@default:default,org.tukaani.xz@default:default,org.w3c.css.sac@default:default,org.w3c.dom.events@default:default,org.w3c.dom.smil*1.0.1.v200903091627@default:default,org.w3c.dom.svg@default:default"/> <stringAttribute key="target_bundles" value="bcpkix@default:default,bcprov@default:default,ca.odell.glazedlists@default:default,ch.ethz.iks.r_osgi.remote@default:default,ch.qos.logback.classic@default:default,ch.qos.logback.core@default:default,ch.qos.logback.slf4j@default:false,com.google.gson@default:default,com.google.guava@default:default,com.google.inject.multibindings@default:false,com.google.inject@default:default,com.ibm.icu@default:default,com.jcraft.jsch@default:default,com.spotify.docker-client.shaded@default:default,com.sun.jersey@default:default,com.sun.syndication@default:default,gov.lbnl.visit.swt@default:default,javax.activation@default:default,javax.el@default:default,javax.inject@default:default,javax.servlet.jsp@default:default,javax.servlet@default:default,javax.ws.rs@default:default,javax.xml@default:default,org.antlr.runtime*3.2.0.v201101311130@default:default,org.antlr.runtime*4.3.0.v201502022030@default:default,org.apache.ant@default:default,org.apache.batik.css*1.7.0.v201011041433@default:default,org.apache.batik.util*1.7.0.v201011041433@default:default,org.apache.batik.util.gui*1.7.0.v200903091627@default:default,org.apache.commons.beanutils@default:default,org.apache.commons.codec@default:default,org.apache.commons.collections@default:default,org.apache.commons.io@default:default,org.apache.commons.jxpath@default:default,org.apache.commons.logging*1.0.4.v201101211617@default:default,org.apache.commons.logging*1.1.1.v201101211721@default:default,org.apache.commons.math@default:default,org.apache.felix.gogo.command@default:default,org.apache.felix.gogo.runtime@default:default,org.apache.felix.gogo.shell@default:default,org.apache.httpcomponents.httpclient@default:default,org.apache.httpcomponents.httpcore@default:default,org.apache.lucene.analysis@default:default,org.apache.lucene.core@default:default,org.eclipse.ant.core@default:default,org.eclipse.cdt.core.linux.x86_64@default:false,org.eclipse.cdt.core.linux@default:false,org.eclipse.cdt.core.native@default:default,org.eclipse.compare.core@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.core.databinding@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.filebuffers@default:default,org.eclipse.core.filesystem.linux.x86_64@default:false,org.eclipse.core.filesystem@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.net.linux.x86_64@default:false,org.eclipse.core.net@default:default,org.eclipse.core.resources@default:default,org.eclipse.core.runtime@default:true,org.eclipse.core.variables@default:default,org.eclipse.debug.core@default:default,org.eclipse.draw2d@default:default,org.eclipse.e4.core.commands@default:default,org.eclipse.e4.core.contexts@default:default,org.eclipse.e4.core.di.annotations@default:default,org.eclipse.e4.core.di.extensions@default:default,org.eclipse.e4.core.di@default:default,org.eclipse.e4.core.services@default:default,org.eclipse.e4.emf.xpath@default:default,org.eclipse.e4.ui.bindings@default:default,org.eclipse.e4.ui.css.core@default:default,org.eclipse.e4.ui.css.swt.theme@default:default,org.eclipse.e4.ui.css.swt@default:default,org.eclipse.e4.ui.di@default:default,org.eclipse.e4.ui.model.workbench@default:default,org.eclipse.e4.ui.services@default:default,org.eclipse.e4.ui.swt.gtk@default:false,org.eclipse.e4.ui.widgets@default:default,org.eclipse.e4.ui.workbench.addons.swt@default:default,org.eclipse.e4.ui.workbench.renderers.swt@default:default,org.eclipse.e4.ui.workbench.swt@default:default,org.eclipse.e4.ui.workbench3@default:default,org.eclipse.e4.ui.workbench@default:default,org.eclipse.eavp.geometry.view.model@default:default,org.eclipse.eavp.viz.datastructures@default:default,org.eclipse.eavp.viz.modeling@default:default,org.eclipse.eavp.viz.service.mesh@default:default,org.eclipse.eavp.viz.service.visit@default:default,org.eclipse.eavp.viz.service@default:default,org.eclipse.eavp.viz@default:default,org.eclipse.ecf.discovery@default:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.ecf.identity@default:default,org.eclipse.ecf.osgi.services.distribution@default:default,org.eclipse.ecf.osgi.services.remoteserviceadmin.proxy@default:default,org.eclipse.ecf.osgi.services.remoteserviceadmin@default:default,org.eclipse.ecf.provider.discovery@default:default,org.eclipse.ecf.provider.filetransfer.httpclient4.ssl@default:false,org.eclipse.ecf.provider.filetransfer.httpclient4@default:default,org.eclipse.ecf.provider.filetransfer.ssl@default:false,org.eclipse.ecf.provider.filetransfer@default:default,org.eclipse.ecf.provider.r_osgi@default:default,org.eclipse.ecf.provider.remoteservice@default:default,org.eclipse.ecf.provider@default:default,org.eclipse.ecf.remoteservice.asyncproxy*1.0.100.v20150702-1411@default:default,org.eclipse.ecf.remoteservice.asyncproxy*2.0.100.v20150702-1411@default:default,org.eclipse.ecf.remoteservice.rest.synd@default:default,org.eclipse.ecf.remoteservice.rest@default:default,org.eclipse.ecf.remoteservice.servlet@default:default,org.eclipse.ecf.remoteservice.soap@default:default,org.eclipse.ecf.remoteservice@default:default,org.eclipse.ecf.sharedobject@default:default,org.eclipse.ecf.ssl@default:false,org.eclipse.ecf@default:default,org.eclipse.emf.common@default:default,org.eclipse.emf.ecore.change@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.emf.ecore@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.bidi@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.concurrent@default:default,org.eclipse.equinox.console@default:default,org.eclipse.equinox.ds@default:true,org.eclipse.equinox.http.jetty@default:default,org.eclipse.equinox.http.registry@default:default,org.eclipse.equinox.http.servlet@default:default,org.eclipse.equinox.http.servletbridge@default:default,org.eclipse.equinox.p2.core@default:default,org.eclipse.equinox.p2.engine@default:default,org.eclipse.equinox.p2.metadata.repository@default:default,org.eclipse.equinox.p2.metadata@default:default,org.eclipse.equinox.p2.repository@default:default,org.eclipse.equinox.p2.transport.ecf@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.region@default:false,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.security@default:default,org.eclipse.equinox.servletbridge@default:default,org.eclipse.equinox.transforms.hook@default:false,org.eclipse.equinox.util@default:default,org.eclipse.equinox.weaving.hook@default:false,org.eclipse.fx.osgi@default:false,org.eclipse.help.base@default:default,org.eclipse.help.ui@default:default,org.eclipse.help@default:default,org.eclipse.january.geometry.model@default:default,org.eclipse.january.geometry.xtext.obj@default:default,org.eclipse.jetty.http@default:default,org.eclipse.jetty.io@default:default,org.eclipse.jetty.security@default:default,org.eclipse.jetty.server@default:default,org.eclipse.jetty.servlet@default:default,org.eclipse.jetty.util@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.jface.text@default:default,org.eclipse.jface@default:default,org.eclipse.jsch.core@default:default,org.eclipse.nebula.visualization.widgets@default:default,org.eclipse.nebula.visualization.xygraph@default:default,org.eclipse.osgi.compatibility.state@default:false,org.eclipse.osgi.services.remoteserviceadmin@default:default,org.eclipse.osgi.services@default:default,org.eclipse.osgi@-1:true,org.eclipse.platform@default:default,org.eclipse.remote.core@default:default,org.eclipse.remote.jsch.core@default:default,org.eclipse.remote.ui@default:default,org.eclipse.swt.gtk.linux.x86_64@default:false,org.eclipse.swt@default:default,org.eclipse.swtbot.ant.junit@default:false,org.eclipse.text@default:default,org.eclipse.ui.cheatsheets@default:default,org.eclipse.ui.console@default:default,org.eclipse.ui.editors@default:default,org.eclipse.ui.forms@default:default,org.eclipse.ui.ide@default:default,org.eclipse.ui.intro@default:default,org.eclipse.ui.navigator@default:default,org.eclipse.ui.trace@default:default,org.eclipse.ui.views.properties.tabbed@default:default,org.eclipse.ui.views@default:default,org.eclipse.ui.workbench.texteditor@default:default,org.eclipse.ui.workbench@default:default,org.eclipse.ui@default:default,org.eclipse.wst.jsdt.nashorn.extension@default:false,org.eclipse.xsd@default:default,org.eclipse.xtend.lib.macro@default:default,org.eclipse.xtend.lib@default:default,org.eclipse.xtext.smap@default:default,org.eclipse.xtext.util@default:default,org.eclipse.xtext.xbase.lib@default:default,org.eclipse.xtext@default:default,org.hamcrest.core@default:default,org.jdom@default:default,org.junit@default:default,org.objectweb.asm@default:default,org.slf4j.api@default:default,org.slf4j.impl.log4j12@default:false,org.slf4j.log4j@default:default,org.tukaani.xz@default:default,org.w3c.css.sac@default:default,org.w3c.dom.events@default:default,org.w3c.dom.smil*1.0.1.v200903091627@default:default,org.w3c.dom.svg@default:default"/>
<stringAttribute key="timestamp" value="1342815545071"/> <stringAttribute key="timestamp" value="1342815545071"/>
<booleanAttribute key="tracing" value="false"/> <booleanAttribute key="tracing" value="false"/>
<booleanAttribute key="useCustomFeatures" value="false"/> <booleanAttribute key="useCustomFeatures" value="false"/>
......
...@@ -37,8 +37,6 @@ import org.eclipse.core.resources.IWorkspaceRoot; ...@@ -37,8 +37,6 @@ import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.FileLocator; import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Platform;
...@@ -168,11 +166,12 @@ public class Core extends Application implements ICore, BundleActivator { ...@@ -168,11 +166,12 @@ public class Core extends Application implements ICore, BundleActivator {
// Setup the ItemManager and the project table // Setup the ItemManager and the project table
itemManager = manager; itemManager = manager;
projectTable = new Hashtable<String, IProject>(); projectTable = new Hashtable<>();
// Set the project location // Set the project location
if (!setupProjectLocation()) { if (!setupProjectLocation()) {
throw new RuntimeException("ICore Message: Unable to load workspace!"); throw new RuntimeException(
"ICore Message: Unable to load workspace!");
} }
// Set the update lock // Set the update lock
...@@ -189,11 +188,12 @@ public class Core extends Application implements ICore, BundleActivator { ...@@ -189,11 +188,12 @@ public class Core extends Application implements ICore, BundleActivator {
// Setup the ItemManager and the project table // Setup the ItemManager and the project table
itemManager = new ItemManager(); itemManager = new ItemManager();
projectTable = new Hashtable<String, IProject>(); projectTable = new Hashtable<>();
// Set the project location // Set the project location
if (!setupProjectLocation()) { if (!setupProjectLocation()) {
throw new RuntimeException("ICore Message: Unable to load workspace!"); throw new RuntimeException(
"ICore Message: Unable to load workspace!");
} }
// Set the update lock // Set the update lock
...@@ -248,13 +248,20 @@ public class Core extends Application implements ICore, BundleActivator { ...@@ -248,13 +248,20 @@ public class Core extends Application implements ICore, BundleActivator {
// Start the webservice! // Start the webservice!
startHttpService(); startHttpService();
// Check the currently registered extensions - LEAVE FOR NOW! ~JJB // Configure the remote service properties
// 20151026 11:15 Dictionary<String, String> props = new Hashtable<>();
// debugCheckExtensions(); // OSGi Standard Property - indicates which of the interfaces of the
// service will be exported. '*' means 'all'.
props.put("service.exported.interfaces", "*");
// OSGi Standard Property (optional) - indicates which provider
// config(s) will be used to export the service
// (If not explicitly given here, the provider is free to choose a
// default configuration for the service)
props.put("service.exported.configs", "ecf.generic.server");
// Register this class as a service with the framework. // Register this class as a service with the framework.
if (context != null) { if (context != null) {
registration = context.registerService(ICore.class, this, null); registration = context.registerService(ICore.class, this, props);
} }
return; return;
...@@ -267,9 +274,11 @@ public class Core extends Application implements ICore, BundleActivator { ...@@ -267,9 +274,11 @@ public class Core extends Application implements ICore, BundleActivator {
if (bundleContext != null) { if (bundleContext != null) {
// Grab the service interface // Grab the service interface
matDBServiceRef = bundleContext.getServiceReference(IMaterialsDatabase.class); matDBServiceRef = bundleContext
.getServiceReference(IMaterialsDatabase.class);
// Get the service // Get the service
IMaterialsDatabase database = bundleContext.getService(matDBServiceRef); IMaterialsDatabase database = bundleContext
.getService(matDBServiceRef);
// This should probably be delegated through the ItemManager. // This should probably be delegated through the ItemManager.
AbstractModelBuilder.setMaterialsDatabase(database); AbstractModelBuilder.setMaterialsDatabase(database);
} }
...@@ -302,38 +311,6 @@ public class Core extends Application implements ICore, BundleActivator { ...@@ -302,38 +311,6 @@ public class Core extends Application implements ICore, BundleActivator {
registration.unregister(); registration.unregister();
} }
/**
* This function is used for logging information on the extensions available
* to the Core.
*
* @deprecated
*/
@Deprecated
private void debugCheckExtensions() {
Set<String> extensionPoints = new HashSet<String>();
extensionPoints.add("org.eclipse.ice.item.itemBuilder");
extensionPoints.add("org.eclipse.ice.item.compositeItemBuilder");
extensionPoints.add("org.eclipse.ice.io.writer");
extensionPoints.add("org.eclipse.ice.io.reader");
extensionPoints.add("org.eclipse.ice.core.persistenceProvider");
extensionPoints.add("org.eclipse.ice.datastructures.jaxbClassProvider");
for (String extensionPointName : extensionPoints) {
IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(extensionPointName);
logger.debug("##### Extensions for: " + extensionPointName + " #####");
if (point != null) {
IExtension[] extensions = point.getExtensions();
for (IExtension extension : extensions) {
logger.debug("--" + extension.getSimpleIdentifier());
}
} else {
logger.debug("Point does not exist");
}
logger.debug("##### end of " + extensionPointName + " #####");
}
}
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
...@@ -344,7 +321,8 @@ public class Core extends Application implements ICore, BundleActivator { ...@@ -344,7 +321,8 @@ public class Core extends Application implements ICore, BundleActivator {
// Register the builder with the ItemManager so long as it is not null // Register the builder with the ItemManager so long as it is not null
if (itemBuilder != null) { if (itemBuilder != null) {
logger.info("ICore Message: Item " + itemBuilder.getItemName() + " registered with Core."); logger.info("ICore Message: Item " + itemBuilder.getItemName()
+ " registered with Core.");
itemManager.registerBuilder(itemBuilder); itemManager.registerBuilder(itemBuilder);
} }
...@@ -361,7 +339,8 @@ public class Core extends Application implements ICore, BundleActivator { ...@@ -361,7 +339,8 @@ public class Core extends Application implements ICore, BundleActivator {
// Register the builder with the ItemManager so long as it is not null // Register the builder with the ItemManager so long as it is not null
if (builder != null) { if (builder != null) {
logger.info("ICore Message: Composite Item " + builder.getItemName() + " registered with Core."); logger.info("ICore Message: Composite Item " + builder.getItemName()
+ " registered with Core.");
itemManager.registerCompositeBuilder(builder); itemManager.registerCompositeBuilder(builder);
} }
...@@ -385,7 +364,8 @@ public class Core extends Application implements ICore, BundleActivator { ...@@ -385,7 +364,8 @@ public class Core extends Application implements ICore, BundleActivator {
@Override @Override
public String createItem(String itemType) { public String createItem(String itemType) {
// This operation retrieves the default "itemDB // This operation retrieves the default "itemDB
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject("itemDB"); IProject project = ResourcesPlugin.getWorkspace().getRoot()
.getProject("itemDB");
return createItem(itemType, project); return createItem(itemType, project);
} }
...@@ -407,7 +387,8 @@ public class Core extends Application implements ICore, BundleActivator { ...@@ -407,7 +387,8 @@ public class Core extends Application implements ICore, BundleActivator {
if (itemType != null && project != null) { if (itemType != null && project != null) {
newItemId = itemManager.createItem(itemType, project); newItemId = itemManager.createItem(itemType, project);
} else { } else {
logger.error("Unable to create Item in the core! Type = " + itemType + " , project = " + project); logger.error("Unable to create Item in the core! Type = " + itemType
+ " , project = " + project);
} }
return String.valueOf(newItemId); return String.valueOf(newItemId);
...@@ -461,7 +442,7 @@ public class Core extends Application implements ICore, BundleActivator { ...@@ -461,7 +442,7 @@ public class Core extends Application implements ICore, BundleActivator {
// FIXME - this is posting a warning in Eclipse about unchecked types. // FIXME - this is posting a warning in Eclipse about unchecked types.
// It passes unit tests, so I am inclined to leave it. // It passes unit tests, so I am inclined to leave it.
ICEList<String> retList = new ICEList<String>(); ICEList<String> retList = new ICEList<>();
// Fix the list // Fix the list
retList.setList(types); retList.setList(types);
...@@ -495,7 +476,8 @@ public class Core extends Application implements ICore, BundleActivator { ...@@ -495,7 +476,8 @@ public class Core extends Application implements ICore, BundleActivator {
* @see ICore#processItem(int itemId, String actionName, int uniqueClientId) * @see ICore#processItem(int itemId, String actionName, int uniqueClientId)
*/ */
@Override @Override
public FormStatus processItem(int itemId, String actionName, int uniqueClientId) { public FormStatus processItem(int itemId, String actionName,
int uniqueClientId) {
// Local Declarations // Local Declarations
FormStatus status = FormStatus.InfoError; FormStatus status = FormStatus.InfoError;
...@@ -573,7 +555,7 @@ public class Core extends Application implements ICore, BundleActivator { ...@@ -573,7 +555,7 @@ public class Core extends Application implements ICore, BundleActivator {
// Local Declarations // Local Declarations
boolean status = false; boolean status = false;
ArrayList<String> serializedItemNames = new ArrayList<String>(); ArrayList<String> serializedItemNames = new ArrayList<>();
SerializedItemBuilder builder = null; SerializedItemBuilder builder = null;
IProject project; IProject project;
IResource[] resources = null; IResource[] resources = null;
...@@ -600,15 +582,18 @@ public class Core extends Application implements ICore, BundleActivator { ...@@ -600,15 +582,18 @@ public class Core extends Application implements ICore, BundleActivator {
// Grab PSF or XML file // Grab PSF or XML file
if (filename.endsWith(".psf") | filename.endsWith(".xml")) { if (filename.endsWith(".psf") | filename.endsWith(".xml")) {
// Get the file // Get the file
file = project.getFile(currentResource.getProjectRelativePath()); file = project.getFile(
currentResource.getProjectRelativePath());
try { try {
// Load the SerializedItemBuilder // Load the SerializedItemBuilder
builder = new SerializedItemBuilder(file.getContents()); builder = new SerializedItemBuilder(
file.getContents());
// Register the builder // Register the builder
itemManager.registerBuilder(builder); itemManager.registerBuilder(builder);
} catch (IOException e) { } catch (IOException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
logger.error(getClass().getName() + " Exception!", e); logger.error(getClass().getName() + " Exception!",
e);
status = false; status = false;
} }
} }
...@@ -647,19 +632,21 @@ public class Core extends Application implements ICore, BundleActivator { ...@@ -647,19 +632,21 @@ public class Core extends Application implements ICore, BundleActivator {
// are no longer using Declarative Services. // are no longer using Declarative Services.
if (bundleContext != null) { if (bundleContext != null) {
// Grab the service reference and the service // Grab the service reference and the service
httpServiceRef = bundleContext.getServiceReference(HttpService.class); httpServiceRef = bundleContext
.getServiceReference(HttpService.class);
// If it is good to go, start up the webserver // If it is good to go, start up the webserver
if (httpServiceRef != null) { if (httpServiceRef != null) {
// Local Declaration // Local Declaration
Dictionary<String, String> servletParams = new Hashtable<String, String>(); Dictionary<String, String> servletParams = new Hashtable<>();
// Get the service // Get the service
httpService = bundleContext.getService(httpServiceRef); httpService = bundleContext.getService(httpServiceRef);
// Set the parameters // Set the parameters
servletParams.put("javax.ws.rs.Application", Core.class.getName()); servletParams.put("javax.ws.rs.Application",
Core.class.getName());
// Register the service // Register the service
try { try {
...@@ -668,7 +655,8 @@ public class Core extends Application implements ICore, BundleActivator { ...@@ -668,7 +655,8 @@ public class Core extends Application implements ICore, BundleActivator {
bundle = bundleContext.getBundle(); bundle = bundleContext.getBundle();
// Make sure we got a valid bundle // Make sure we got a valid bundle
if (bundle == null) { if (bundle == null) {
logger.info("ICE Core Bundle was null! No web service started."); logger.info(
"ICE Core Bundle was null! No web service started.");
return; return;
} }
...@@ -678,10 +666,14 @@ public class Core extends Application implements ICore, BundleActivator { ...@@ -678,10 +666,14 @@ public class Core extends Application implements ICore, BundleActivator {
// Resolve the URLs to be absolute // Resolve the URLs to be absolute
resourceURL = FileLocator.resolve(resourceURL); resourceURL = FileLocator.resolve(resourceURL);
configFileURL = FileLocator.resolve(configFileURL); configFileURL = FileLocator.resolve(configFileURL);
HttpContext httpContext = new BasicAuthSecuredContext(resourceURL, configFileURL, HttpContext httpContext = new BasicAuthSecuredContext(
resourceURL, configFileURL,
"ICE Core Server Configuration"); "ICE Core Server Configuration");
httpService.registerServlet("/ice", new ServletContainer(this), servletParams, httpContext); httpService.registerServlet("/ice",
} catch (ServletException | NamespaceException | IOException e) { new ServletContainer(this), servletParams,
httpContext);
} catch (ServletException | NamespaceException
| IOException e) {
logger.error(getClass().getName() + " Exception!", e); logger.error(getClass().getName() + " Exception!", e);
} }
logger.info("ICE Core Server loaded and web service started!"); logger.info("ICE Core Server loaded and web service started!");
...@@ -706,7 +698,7 @@ public class Core extends Application implements ICore, BundleActivator { ...@@ -706,7 +698,7 @@ public class Core extends Application implements ICore, BundleActivator {
@Override @Override
public Set<Object> getSingletons() { public Set<Object> getSingletons() {
// Create a set that just points to this class as the servlet // Create a set that just points to this class as the servlet
Set<Object> result = new HashSet<Object>(); Set<Object> result = new HashSet<>();
result.add(this); result.add(this);
return result; return result;
} }
...@@ -742,7 +734,8 @@ public class Core extends Application implements ICore, BundleActivator { ...@@ -742,7 +734,8 @@ public class Core extends Application implements ICore, BundleActivator {
// If the project does not exist, create it // If the project does not exist, create it
if (!project.exists()) { if (!project.exists()) {
// Create the project description // Create the project description
IProjectDescription desc = ResourcesPlugin.getWorkspace().newProjectDescription(defaultProjectName); IProjectDescription desc = ResourcesPlugin.getWorkspace()
.newProjectDescription(defaultProjectName);
// Create the project // Create the project
project.create(desc, null); project.create(desc, null);
} }
...@@ -831,7 +824,7 @@ public class Core extends Application implements ICore, BundleActivator { ...@@ -831,7 +824,7 @@ public class Core extends Application implements ICore, BundleActivator {
private ArrayList<Message> buildMessagesFromString(String messageString) { private ArrayList<Message> buildMessagesFromString(String messageString) {
// Create the ArrayList of messages // Create the ArrayList of messages
ArrayList<Message> messages = new ArrayList<Message>(); ArrayList<Message> messages = new ArrayList<>();
// Create the parser and gson utility // Create the parser and gson utility
JsonParser parser = new JsonParser(); JsonParser parser = new JsonParser();
...@@ -846,11 +839,13 @@ public class Core extends Application implements ICore, BundleActivator { ...@@ -846,11 +839,13 @@ public class Core extends Application implements ICore, BundleActivator {
JsonObject messageJsonObject = messageJson.getAsJsonObject(); JsonObject messageJsonObject = messageJson.getAsJsonObject();
// Get the Item id from the json // Get the Item id from the json
JsonPrimitive itemIdJson = messageJsonObject.getAsJsonPrimitive("item_id"); JsonPrimitive itemIdJson = messageJsonObject
.getAsJsonPrimitive("item_id");
int itemId = itemIdJson.getAsInt(); int itemId = itemIdJson.getAsInt();
// Get the array of posts from the message // Get the array of posts from the message
JsonArray jsonMessagesList = messageJsonObject.getAsJsonArray("posts"); JsonArray jsonMessagesList = messageJsonObject
.getAsJsonArray("posts");
// Load the list // Load the list
for (int i = 0; i < jsonMessagesList.size(); i++) { for (int i = 0; i < jsonMessagesList.size(); i++) {
...@@ -867,7 +862,8 @@ public class Core extends Application implements ICore, BundleActivator { ...@@ -867,7 +862,8 @@ public class Core extends Application implements ICore, BundleActivator {
} }
} catch (JsonParseException e) { } catch (JsonParseException e) {
// Log the message // Log the message
String err = "Core Message: " + "JSON parsing failed for message " + messageString; String err = "Core Message: " + "JSON parsing failed for message "
+ messageString;
logger.error(getClass().getName() + " Exception!", e); logger.error(getClass().getName() + " Exception!", e);
logger.error(err); logger.error(err);
} }
...@@ -891,7 +887,8 @@ public class Core extends Application implements ICore, BundleActivator { ...@@ -891,7 +887,8 @@ public class Core extends Application implements ICore, BundleActivator {
// Print the message if debugging is enabled // Print the message if debugging is enabled
// if (debuggingEnabled) { // if (debuggingEnabled) {
logger.info("Core Message: " + "Update received with message: " + message); logger.info(
"Core Message: " + "Update received with message: " + message);
// } // }
// Only process the message if it exists and is not empty // Only process the message if it exists and is not empty
...@@ -901,7 +898,8 @@ public class Core extends Application implements ICore, BundleActivator { ...@@ -901,7 +898,8 @@ public class Core extends Application implements ICore, BundleActivator {
String[] messageParts = message.split("="); String[] messageParts = message.split("=");
if (messageParts.length > 1) { if (messageParts.length > 1) {
// Get the message object. // Get the message object.
ArrayList<Message> msgList = buildMessagesFromString(messageParts[1]); ArrayList<Message> msgList = buildMessagesFromString(
messageParts[1]);
// Post the messages if there are any. Fail otherwise. // Post the messages if there are any. Fail otherwise.
if (!msgList.isEmpty()) { if (!msgList.isEmpty()) {
for (int i = 0; i < msgList.size(); i++) { for (int i = 0; i < msgList.size(); i++) {
...@@ -935,7 +933,8 @@ public class Core extends Application implements ICore, BundleActivator { ...@@ -935,7 +933,8 @@ public class Core extends Application implements ICore, BundleActivator {
* java.lang.String, org.eclipse.core.resources.IProject) * java.lang.String, org.eclipse.core.resources.IProject)
*/ */
@Override @Override
public String importFileAsItem(URI file, String itemType, IProject project) { public String importFileAsItem(URI file, String itemType,
IProject project) {
// Local Declarations // Local Declarations
int newItemId = -1; int newItemId = -1;
...@@ -946,7 +945,8 @@ public class Core extends Application implements ICore, BundleActivator { ...@@ -946,7 +945,8 @@ public class Core extends Application implements ICore, BundleActivator {
importFile(file, project); importFile(file, project);
// Get the name of the file. This is only created to get the short // Get the name of the file. This is only created to get the short
// name of the file. Then create the Item // name of the file. Then create the Item
newItemId = itemManager.createItem(new File(file).getName(), itemType, project); newItemId = itemManager.createItem(new File(file).getName(),
itemType, project);
} }
return String.valueOf(newItemId); return String.valueOf(newItemId);
...@@ -963,7 +963,8 @@ public class Core extends Application implements ICore, BundleActivator { ...@@ -963,7 +963,8 @@ public class Core extends Application implements ICore, BundleActivator {
// This is an IFile, meaning it came from an existing // This is an IFile, meaning it came from an existing
// IProject, call importFileAsItem with the file URI and its // IProject, call importFileAsItem with the file URI and its
// corresponding IProject // corresponding IProject
return importFileAsItem(file.getLocationURI(), itemType, file.getProject()); return importFileAsItem(file.getLocationURI(), itemType,
file.getProject());
} }
/** /**
...@@ -973,9 +974,11 @@ public class Core extends Application implements ICore, BundleActivator { ...@@ -973,9 +974,11 @@ public class Core extends Application implements ICore, BundleActivator {
* java.lang.String, java.lang.String) * java.lang.String, java.lang.String)
*/ */
@Override @Override
public String importFileAsItem(URI file, String itemType, String projectName) { public String importFileAsItem(URI file, String itemType,
String projectName) {
// Get the project associated with the project name // Get the project associated with the project name
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); IProject project = ResourcesPlugin.getWorkspace().getRoot()
.getProject(projectName);
// Import it as normal // Import it as normal
return importFileAsItem(file, itemType, project); return importFileAsItem(file, itemType, project);
...@@ -1004,12 +1007,13 @@ public class Core extends Application implements ICore, BundleActivator { ...@@ -1004,12 +1007,13 @@ public class Core extends Application implements ICore, BundleActivator {
@Override @Override
public void importFile(URI file, String projectName) { public void importFile(URI file, String projectName) {
// Local Declarations // Local Declarations
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); IProject project = ResourcesPlugin.getWorkspace().getRoot()
.getProject(projectName);
if (project != null) { if (project != null) {
importFile(file, project); importFile(file, project);
} else { } else {
logger.info( logger.info("File could not be imported into project " + projectName
"File could not be imported into project " + projectName + " because the project does not exist."); + " because the project does not exist.");
} }
} }
...@@ -1029,7 +1033,8 @@ public class Core extends Application implements ICore, BundleActivator { ...@@ -1029,7 +1033,8 @@ public class Core extends Application implements ICore, BundleActivator {
IFile fileInProject = project.getFile(path.lastSegment()); IFile fileInProject = project.getFile(path.lastSegment());
// Get the paths and convert them to strings // Get the paths and convert them to strings
IPath fullPathInProject = fileInProject.getLocation(); IPath fullPathInProject = fileInProject.getLocation();
String path1 = path.toString(), path2 = fullPathInProject.toString(); String path1 = path.toString(),
path2 = fullPathInProject.toString();
// Remove devices ids and other such things from the path strings // Remove devices ids and other such things from the path strings
path1 = path1.substring(path1.lastIndexOf(":") + 1); path1 = path1.substring(path1.lastIndexOf(":") + 1);
path2 = path2.substring(path2.lastIndexOf(":") + 1); path2 = path2.substring(path2.lastIndexOf(":") + 1);
...@@ -1045,14 +1050,16 @@ public class Core extends Application implements ICore, BundleActivator { ...@@ -1045,14 +1050,16 @@ public class Core extends Application implements ICore, BundleActivator {
fileInProject.delete(true, null); fileInProject.delete(true, null);
} catch (CoreException e) { } catch (CoreException e) {
// Complain and don't do anything else. // Complain and don't do anything else.
logger.info("Core Message: " + "Unable to import file."); logger.info(
"Core Message: " + "Unable to import file.");
logger.error(getClass().getName() + " Exception!", e); logger.error(getClass().getName() + " Exception!"