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

Merged the IJAXBClassProvider changes from @menghanli.



Menghan's commit included autogenerated make files that are not needed,
so I removed them. Here getJAXBProviders() operation has a bug in it
too, which I will fix in the next commit. We still need a bug # for this
work too.
Signed-off-by: default avatarJay Jay Billings <billingsjj@ornl.gov>
parents 2aa50f3b 1b9a09a5
......@@ -52,6 +52,7 @@ import org.eclipse.ice.datastructures.form.FormStatus;
import org.eclipse.ice.io.serializable.IIOService;
import org.eclipse.ice.item.ICompositeItemBuilder;
import org.eclipse.ice.item.ItemBuilder;
import org.eclipse.ice.item.Registry;
import org.eclipse.ice.item.SerializedItemBuilder;
import org.eclipse.ice.item.messaging.Message;
import org.eclipse.ice.item.persistence.IPersistenceProvider;
......@@ -259,8 +260,15 @@ public class Core extends Application implements ICore, BundleActivator {
// load items.
itemManager.setPersistenceProvider(provider);
}
// Load up the ItemBuilders
ItemBuilder [] builders = ItemBuilder.getItemBuilders();
for (ItemBuilder builder : builders) {
registerItem(builder);
}
/** to delete later
ItemBuilder builder = null;
IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(builderID);
......@@ -276,6 +284,7 @@ public class Core extends Application implements ICore, BundleActivator {
} else {
logger.error("Extension Point " + builderID + "does not exist");
}
**/
// Tell the ItemManager to suit up. It's time to rock and roll.
itemManager.loadItems(itemDBProject);
......
......@@ -2,6 +2,6 @@
<classpath>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="output" path="bin"/>
</classpath>
......@@ -8,6 +8,7 @@ Require-Bundle: org.junit;bundle-version="4.8.2",
Import-Package: ca.odell.glazedlists,
ca.odell.glazedlists.event,
ca.odell.glazedlists.gui,
org.eclipse.core.runtime;version="3.5.0",
org.eclipse.emf.common.util,
org.eclipse.emf.ecore.xmi,
org.eclipse.emf.ecore.xmi.impl,
......@@ -30,5 +31,5 @@ Import-Package: ca.odell.glazedlists,
org.osgi.util.tracker;version="1.5.0"
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.ice.datastructures.test
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-Vendor: Oak Ridge National Laboratory
/*******************************************************************************
* Copyright (c) 2013, 2014- UT-Battelle, LLC.
* 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:
* Initial API and implementation and/or initial documentation -
* Jay Jay Billings
*******************************************************************************/
package org.eclipse.ice.datastructures.test;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.ice.datastructures.jaxbclassprovider.IJAXBClassProvider;
import org.junit.Test;
/**
* This class tests the static interface operation
* ItemBuilder.getItemBuilders().
*
* @author Jay Jay Billings
*
*/
public class IJAXBClassProviderTester {
/**
* Test for {@link org.eclipse.ice.item.ItemBuilder}.
*
* @throws CoreException
*/
@Test
public void test() throws CoreException {
// Simply get the builders from the registry and make sure they are
// actually there.
IJAXBClassProvider[] providers = IJAXBClassProvider.getJAXBProviders();
assertNotNull(providers);
assertTrue(providers.length > 0);
return;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
......
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.compiler.source=1.8
......@@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: ICEDataStructures
Bundle-SymbolicName: org.eclipse.ice.datastructures;singleton:=true
Bundle-Version: 2.1.7.20150825
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Service-Component: OSGI-INF/*.xml
Meta-Persistence: META-INF/persistence.xml
Export-Package: org.eclipse.ice.datastructures.ICEObject,
......@@ -18,6 +18,7 @@ Export-Package: org.eclipse.ice.datastructures.ICEObject,
Import-Package: ca.odell.glazedlists,
ca.odell.glazedlists.event,
org.eclipse.core.runtime.content,
org.eclipse.core.runtime;version="3.5.0",
org.eclipse.emf.common,
org.eclipse.emf.common.util,
org.eclipse.emf.ecore,
......
......@@ -14,6 +14,13 @@ package org.eclipse.ice.datastructures.jaxbclassprovider;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.Platform;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* The IJAXBClassProvider interface provides the methods necessary to inform
* clients creating a JAXBContext object of the relevant classes that must be
......@@ -44,5 +51,43 @@ public interface IJAXBClassProvider {
* @return providerName The name of this IJAXBClassProvider
*/
public String getProviderName();
/**
* This operation pulls the list of JAXB class providers from the registry
* for classes that need custom handling.
*
* @return The list of class providers.
* @throws CoreException
*/
public static IJAXBClassProvider[] getJAXBProviders() throws CoreException {
/**
* Logger for handling event messages and other information.
*/
Logger logger = LoggerFactory.getLogger(IJAXBClassProvider.class);
IJAXBClassProvider[] jaxbProviders = null;
String id = "org.eclipse.ice.item.itemBuilder";
IExtensionPoint point = Platform.getExtensionRegistry()
.getExtensionPoint(id);
// If the point is available, create all the builders and load them into
// the array.
if (point != null) {
IConfigurationElement[] elements = point.getConfigurationElements();
jaxbProviders = new IJAXBClassProvider[elements.length];
for (int i = 0; i < elements.length; i++) {
jaxbProviders[i] = (IJAXBClassProvider) elements[i]
.createExecutableExtension("class");
}
} else {
logger.error("Extension Point " + id + "does not exist");
}
return jaxbProviders;
}
}
......@@ -14,11 +14,7 @@ package org.eclipse.ice.persistence.xml;
import javax.xml.bind.JAXBException;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExecutableExtensionFactory;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.Platform;
import org.eclipse.ice.datastructures.jaxbclassprovider.IJAXBClassProvider;
import org.eclipse.ice.item.ItemBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -85,34 +81,4 @@ public class XMLPersistenceExtensionFactory
return provider;
}
/**
* This operation pulls the list of JAXB class providers from the registry
* for classes that need custom handling.
*
* @return The list of class providers.
* @throws CoreException
*/
private IJAXBClassProvider[] getJAXBProviders() throws CoreException {
IJAXBClassProvider[] jaxbProviders = null;
String id = "org.eclipse.ice.item.itemBuilder";
IExtensionPoint point = Platform.getExtensionRegistry()
.getExtensionPoint(id);
// If the point is available, create all the builders and load them into
// the array.
if (point != null) {
IConfigurationElement[] elements = point.getConfigurationElements();
jaxbProviders = new IJAXBClassProvider[elements.length];
for (int i = 0; i < elements.length; i++) {
jaxbProviders[i] = (IJAXBClassProvider) elements[i]
.createExecutableExtension("class");
}
} else {
logger.error("Extension Point " + id + "does not exist");
}
return jaxbProviders;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment