* ICore is an interface that is realized by Core and used by clients that
* connect to the Core. It describes the services and data available upon
* request from the server.
- *
- *
+ *
* The Connect() operation must be called to obtain a unique identification
* number for the client. After that, all of the other operations on this
* interface will be available.
- *
- *
+ *
* Realizations of ICore are intended to be used as web-APIs and, to that end,
* many of the arguments in the operations are Strings that should be safe to
* cast to integers.
- *
- *
- *
- *
*
* @author Jay Jay Billings
- * @generated
- * "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
*/
@Path("/")
public interface ICore {
/**
- *
- *
* This operation "connects" a client to the ICore. The connection in this
* case is represented by a unique client id that is returned from this
* operation. It is safe to parse this id as an integer and that integer
* should always be greater than 0.
- *
- *
*
- * @return
- * The unique client identification number that has been assigned to
+ * @return The unique client identification number that has been assigned to
* the client that made the request. It is safe to parse this string
* as an integer.
- *
- * @generated
- * "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
*/
@GET
@Produces("text/plain")
public String connect();
/**
- *
- *
* This operation will disconnect a client from the remote server if it is
* connected.
- *
- *
*
* @param uniqueClientId
- *
* The unique client identification number of the client that
* would like to disconnect.
- *
- * @generated
- * "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
*/
public void disconnect(int uniqueClientId);
/**
- *
- *
* This operation retrieves the workspace file system available to the
* ICEUser. It returns a Form that contains the directory structure.
- *
- *
*
* @param uniqueClientID
- *
* The unique ID of the Client calling the operation.
- *
- * @return
- * A Form that contains a description of the workspace file system
+ * @return A Form that contains a description of the workspace file system
* available to the ICEUser.
- *
- * @generated
- * "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
*/
public Form getFileSystem(int uniqueClientID);
/**
- *
- *
* This operation registers an ItemBuilder and thereby a particular Item
* class with the Core. This operation is primarily used by the underlying
* OSGi framework to publish available Item types to ICE.
- *
- *
*
* @param itemBuilder
- *
* An instance of ItemBuilder for a particular Item that is
* available to the Core.
- *
- * @generated
- * "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
*/
public void registerItem(ItemBuilder itemBuilder);
/**
- *
- *
* This operation registers a composite Item with the ICore. Composite Items
* are Items that depend on other Items to function. This operation is
* primarily used by the underlying OSGi framework to publish available Item
* types to ICE.
- *
- *
*
* @param builder
- *
* The ICompositeItemBuilder that will build the composite Item.
- *
- * @generated
- * "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
*/
public void registerCompositeItem(ICompositeItemBuilder builder);
/**
- *
- *
* This operation unregisters an ItemBuilder and thereby a particular Item
* class with the Core. This operation is primarily used by the underlying
* OSGi framework to notify ICE if or when a particular type of Item, which
* is stored in an OSGi bundle, becomes unavailable.
- *
- *
*
* @param itemBuilder
- *
* An instance of ItemBuilder for a particular Item that is now
* unavailable to the Core.
- *
- * @generated
- * "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
*/
public void unregisterItem(ItemBuilder itemBuilder);
/**
- *
- *
* This operation directs ICE to create a new Item. If the Item is
* successfully created, it returns the identification number of the new
* Item. The caller of this operation should immediately inquire after the
* status of the Item that was created using the getItemStatus() operation
* to determine if more information is required to make the Item usable.
- *
- *
*
* @param itemType
- *
* The type of Item to create.
- *
- * @return
- * The identification number given as a String of the newly created
+ * @return The identification number given as a String of the newly created
* Item or -1 if it was unable to create the Item. It is safe to
* parse this string as an integer.
- *
- * @generated
- * "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
*/
@POST
@Path("items/create")
@@ -209,69 +139,40 @@ public interface ICore {
public String createItem(String itemType);
/**
- *
- *
* This operation directs the ICore to permanently delete an Item. Again:
* this is permanent!
- *
- *
*
* @param itemId
- *
* The identification number of the Item that should be deleted
* given as a String. It is safe to parse this string as an
* integer.
- *
- * @generated
- * "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
*/
public void deleteItem(String itemId);
/**
- *
- *
* This operation returns the status an Item.
- *
- *
*
* @param id
- *
* The identification number of the Item that should be checked.
- *
- * @return
- * The status of the Item.
- *
- * @generated
- * "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
+ * @return The status of the Item.
*/
public FormStatus getItemStatus(Integer id);
/**
- *
- *
* This operation returns the representational state, a Form, of an Item
* that is managed by the ICore to the caller.
- *
- *
+ *
* If this operation is called immediately after processItem() with the same
* Item id and the call to processItem() returns FormStatus.NeedsInfo, then
* this operation will return a simple Form composed of a single
* DataComponent with Entries for all of the additional required
* information. The smaller Form is created by the Action that is executed
* during the call to processItem().
- *
- *
*
* @param itemId
- *
* The identification number of the Item that should be
* retrieved.
- *
- * @return
- * A Form that represents the Item managed by the core.
- *
- * @generated
- * "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
+ * @return A Form that represents the Item managed by the core.
*/
@GET
@Path("items/{id}")
@@ -279,21 +180,13 @@ public interface ICore {
public Form getItem(@PathParam("id") int itemId);
/**
- *
- *
* This operation returns a list of the available Item types that can be
* created by ICE or null if no Items are registered with the Core. It
* returns an ICEList of Strings, (i.e. - ICEList<Strings> in Java).
- *
- *
*
- * @return
- * The list of ItemTypes that can be created by ICE. This list is
+ * @return The list of ItemTypes that can be created by ICE. This list is
* determined by the Items that are currently registered with the
* running realization of ICore.
- *
- * @generated
- * "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
*/
@GET
@Path("items")
@@ -301,91 +194,57 @@ public interface ICore {
public ICEList getAvailableItemTypes();
/**
- *
- *
* This operation posts an updated Form to the Core so that the updated
* information can be processed by the appropriate Item.
- *
- *
*
* @param form
- *
* The Form that carries new information for an Item.
- *
* @param uniqueClientId
- *
* The unique client id the IClient that is making the update
* request.
- *
- * @return
- * The status of the updated Item.
- *
- * @generated
- * "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
+ * @return The status of the updated Item.
*/
public FormStatus updateItem(Form form, int uniqueClientId);
/**
- *
- *
* This operation directs the Core to process the Item with the specified id
* by performing the specific action. The action name must be one of the set
* of actions from the Form that represents the Item with the specified id.
- *
- *
+ *
* It is possible that ICE may require information in addition to that which
* was requested in the original Form, such as for a username and password
* for a remote machine. If this is the case, processItem will return
* FormStatus.NeedsInfo and a new, temporary Form will be available for the
* Item by calling getItem(). Once this new Form is submitted (by calling
* updateItem() with the completed Form), the Item will finish processing.
- *
- *
*
* @param itemId
- *
* The item id for the Item that should be processed with the
* specified action.
- *
+ *
* @param actionName
- *
* The action that should be performed on the Item.
- *
+ *
* @param uniqueClientId
- *
* The unique identification number of the client making the
* request.
- *
- * @return
- * The status of the Item after the action was performed.
- *
- * @generated
- * "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
+ *
+ * @return The status of the Item after the action was performed.
*/
public FormStatus processItem(int itemId, String actionName,
int uniqueClientId);
/**
- *
- *
* This operation returns the list of Items that have been created in ICE.
* It returns a list of ICEObjects that represent those Items and provide
* the name, description and identification number. This operation is only
* meant to provide information about the Items.
- *
- *
*
- * @return
- * The list of Identifiables that represent the Items.
- *
- * @generated
- * "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
+ * @return The list of Identifiables that represent the Items.
*/
public ArrayList getItemList();
/**
- *
- *
* This operation returns a file handle to the output file for the Item with
* the specified id. It returns a handle to the file whether or not it
* actually exists and clients should check the File.exists() operation
@@ -394,106 +253,66 @@ public FormStatus processItem(int itemId, String actionName,
* returned is the real file handle and can be written, but clients
* should be careful to only read from the file. It will return null if an
* Item with the specified id does not exist.
- *
- *
*
* @param id
- *
* The id of the Item.
- *
- * @return
- * The output file for the specified Item, thoroughly documented
+ * @return The output file for the specified Item, thoroughly documented
* elsewhere.
- *
- * @generated
- * "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
*/
public File getItemOutputFile(int id);
/**
- *
- *
* This operation cancels the process with the specified name for the Item
* identified.
- *
- *
*
* @param itemId
- *
* The id of the Item whose process should be canceled.
- *
* @param actionName
- *
* The name of the action that should be canceled for the
* specified Item.
- *
- * @return
- * The status
- *
- * @generated
- * "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
+ * @return The status
*/
public FormStatus cancelItemProcess(int itemId, String actionName);
/**
- *
- *
* This operation directs the core to import a file into its workspace.
- *
- *
*
* @param file
- *
* The file that should be imported. Nothing will happen if this
* argument is null.
- *
- * @generated
- * "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
*/
public void importFile(URI file);
/**
- *
- *
* This operation directs the core to import a file into its workspace and
* load that file as an input for the specified Item type. It returns the id
* of the newly created Item.
- *
- *
*
* @param file
- *
* The file that should be imported. Nothing will happen if this
* argument is null.
- *
* @param itemType
- *
* The type of Item to create.
- *
- * @return
+ * @return
* The identification number given as a String of the newly created
* Item or -1 if it was unable to create the Item. It is safe to
* parse this string as an integer.
- *
- * @generated
- * "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
*/
public String importFileAsItem(URI file, String itemType);
/**
* This operation posts a message containing an update to the ICE Item
* designated in the body of the message.
- *
+ *
* This operation is primarily used by the ICE Updater to post messages to
* the Core from remote processes. The message format can be found in the
* documentation for the Updater.
- *
+ *
* @param message
* The message that should be passed on to the specified Item.
* This string must be in JSON and conform to the message format
* of the ICE Updater.
- * @return
- * "OK" if the post was successful, null if not to conform to JAX-RS
+ * @return "OK" if the post was successful, null if not to conform to JAX-RS
* HTTP 200/204 return code conversion.
*/
@POST
diff --git a/src/org.eclipse.ice.core/src/org/eclipse/ice/core/internal/BasicAuthSecuredContext.java b/src/org.eclipse.ice.core/src/org/eclipse/ice/core/internal/BasicAuthSecuredContext.java
index 54b2c80e6..52ed56f53 100644
--- a/src/org.eclipse.ice.core/src/org/eclipse/ice/core/internal/BasicAuthSecuredContext.java
+++ b/src/org.eclipse.ice.core/src/org/eclipse/ice/core/internal/BasicAuthSecuredContext.java
@@ -150,6 +150,7 @@ public boolean handleSecurity(HttpServletRequest request,
// Make sure an authorization header is available
String auth = request.getHeader("Authorization");
+
// Fail if not
if (auth == null) {
return failAuthorization(request, response);
@@ -157,14 +158,17 @@ public boolean handleSecurity(HttpServletRequest request,
// Determine the authentication schemed
StringTokenizer tokens = new StringTokenizer(auth);
String authscheme = tokens.nextToken();
+
// Fail if HTTP Basic authentication is not used
if (!("Basic".equals(authscheme))) {
return failAuthorization(request, response);
}
+
// Decode the credentials, which are encoded in Base64
String base64credentials = tokens.nextToken();
String credentials = new String(Base64.decodeBase64(base64credentials
.getBytes()));
+
// The userid is on the left side of the colon and the password on the
// right
int colon = credentials.indexOf(':');
diff --git a/src/org.eclipse.ice.core/src/org/eclipse/ice/core/internal/Core.java b/src/org.eclipse.ice.core/src/org/eclipse/ice/core/internal/Core.java
index 3fc334007..2188a005b 100644
--- a/src/org.eclipse.ice.core/src/org/eclipse/ice/core/internal/Core.java
+++ b/src/org.eclipse.ice.core/src/org/eclipse/ice/core/internal/Core.java
@@ -76,74 +76,43 @@
import com.sun.jersey.spi.container.servlet.ServletContainer;
/**
- *
- *
* The Core class is responsible for implementing and/or managing all of the
* data and workflow management capabilities of ICE. It implements the ICore
* interface and provides additional administration operations not found on
* ICore. Most of the operations performed for managing Items are forwarded
* directly to the ItemManager class.
- *
- *
*
* @author Jay Jay Billings
- * @generated
- * "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
*/
@ApplicationPath("/ice")
public class Core extends Application implements ICore {
/**
- *
- *
- * @generated
- * "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
+ * Reference to the ItemManager responsible for creating, querying, and
+ * updating available Items.
*/
private ItemManager itemManager;
/**
- *
- *
* The component context for the ICE Core OSGi component.
- *
* The persistence provided by the osgi. This piece is set by the
* setPersistenceProvider method. This piece is passed to the ItemManager to
* be used for persisting Items.
- *
* This operation scans the default project area for SerializedItems and
* loads them into the Core. It returns false if it encounters and error and
* true if it is successful.
- *
- *
*
- * @return
- * True if the SerializedItems stored in the default project area
+ * @return True if the SerializedItems stored in the default project area
* were loaded successfully, false otherwise.
- *
* This operation sets the HTTP service that should be used by the Core to
* publish itself.
- *
- *
*
* @param service
- *
* The HTTP service.
- *
- * @generated
- * "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
*/
public void setHttpService(HttpService service) {
- // begin-user-code
// Set the webservice reference
httpService = service;
System.out.println("ICore Message: Web service set!");
+ }
+ /**
+ * Private method used by Core.start() method to start the HttpService.
+ */
+ private void startHttpService() {
// If it is good to go, start up the webserver
if (httpService != null) {
@@ -748,18 +589,14 @@ public void setHttpService(HttpService service) {
// Register the service
try {
// Get the bundle
- Bundle bundle = null;
- if (componentContext != null) {
- bundle = componentContext.getBundleContext().getBundle();
- } else {
- return;
- }
-
+ Bundle bundle = componentContext.getBundleContext().getBundle();
// Make sure we got a valid bundle
if (bundle == null) {
+ System.out
+ .println("ICore Message: Could not get a valid reference to the Bundle. Start Http Service Failed.");
return;
}
-
+
// Find the root location and the jaas_config file
URL resourceURL = bundle.getEntry("");
URL configFileURL = bundle.getEntry("jaas_config.txt");
@@ -771,14 +608,7 @@ public void setHttpService(HttpService service) {
"ICE Core Server Configuration");
httpService.registerServlet("/ice", new ServletContainer(this),
servletParams, httpContext);
- } catch (ServletException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (NamespaceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (IOException e) {
- // TODO Auto-generated catch block
+ } catch (ServletException | NamespaceException | IOException e) {
e.printStackTrace();
}
System.out.println("ICore Message: ICE Core Server loaded and web "
@@ -791,49 +621,28 @@ public void setHttpService(HttpService service) {
}
/**
- *
- *
* This operation returns the current instance of the ICE core to the HTTP
* service so that it can be published. It overrides
* Application.getSingletons().
- *
- *
*
- * @return
- * The set of "singletons" - in this case just the running instance
+ * @return The set of "singletons" - in this case just the running instance
* of the Core.
- *
- * @generated
- * "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
*/
public Set
*
- * @return
- * True if the setup operation was successful and false otherwise.
- *
- * @generated
- * "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
+ * @return True if the setup operation was successful and false otherwise.
*/
private boolean setupProjectLocation() {
- // begin-user-code
// Local Declarations
IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
@@ -882,72 +691,47 @@ private boolean setupProjectLocation() {
status = loadDefaultAreaItems();
}
return status;
- // end-user-code
}
/**
- *
- *
* This operation sets the persistence provider from the
* IPersistenceProvider interface. This is picked up via OSGI.
- *
- *
*
* @param provider
- *
* The persistence provider.
- *
- * @generated
- * "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
*/
public void setPersistenceProvider(IPersistenceProvider provider) {
- // begin-user-code
// If the provider is not null, store the reference and log a message.
if (provider != null) {
System.out.println("ICore Message: PersistenceProvider set!");
this.provider = provider;
}
-
- // end-user-code
}
/**
* (non-Javadoc)
*
* @see ICore#connect()
- * @generated
- * "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
*/
public String connect() {
- // begin-user-code
return "1";
- // end-user-code
}
/**
* (non-Javadoc)
*
* @see ICore#disconnect(int uniqueClientId)
- * @generated
- * "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
*/
public void disconnect(int uniqueClientId) {
- // begin-user-code
- // TODO Auto-generated method stub
-
- // end-user-code
}
/**
* (non-Javadoc)
*
* @see ICore#importFileAsItem(URI file, String itemType)
- * @generated
- * "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
*/
public String importFileAsItem(URI file, String itemType) {
- // begin-user-code
// Local Declarations
int newItemId = -1;
@@ -966,7 +750,6 @@ public String importFileAsItem(URI file, String itemType) {
}
return String.valueOf(newItemId);
- // end-user-code
}
/**
@@ -977,7 +760,7 @@ public String importFileAsItem(URI file, String itemType) {
*
* @param messageString
* The original message, as a string
- * @return
+ * @return list list of built messages.
*/
private ArrayList buildMessagesFromString(String messageString) {
@@ -1030,11 +813,8 @@ private ArrayList buildMessagesFromString(String messageString) {
* (non-Javadoc)
*
* @see ICore#postUpdateMessage(String message)
- * @generated
- * "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
*/
public String postUpdateMessage(String message) {
- // begin-user-code
// Lock the operation
updateLock.set(true);
@@ -1070,6 +850,5 @@ public String postUpdateMessage(String message) {
// Unlock the operation and return safely
return (updateLock.getAndSet(false)) ? retVal : null;
- // end-user-code
}
}
\ No newline at end of file
From bdb4066159fb1afa2d97d1d1ae3f2db44e267f9a Mon Sep 17 00:00:00 2001
From: Alex McCaskey
Date: Wed, 22 Apr 2015 14:29:00 -0400
Subject: [PATCH 5/5] Fixing org.eclipse.ice.core build error, forgot to change
the min exec env to Java 1.7 since I added a multi-exception catch statement.
Removed a few test bundles from the launch configurations.
Signed-off-by: Alex McCaskey
---
features/org.eclipse.ice.feature/feature.xml | 7 -------
.../org.eclipse.ice.repository/ice.macosx_product.launch | 2 +-
repository/org.eclipse.ice.repository/ice.product | 1 -
repository/org.eclipse.ice.repository/ice.product.launch | 4 ++--
src/org.eclipse.ice.core/META-INF/MANIFEST.MF | 2 +-
5 files changed, 4 insertions(+), 12 deletions(-)
diff --git a/features/org.eclipse.ice.feature/feature.xml b/features/org.eclipse.ice.feature/feature.xml
index 55496f869..f360f93a0 100644
--- a/features/org.eclipse.ice.feature/feature.xml
+++ b/features/org.eclipse.ice.feature/feature.xml
@@ -2338,11 +2338,4 @@ Java and all Java-based trademarks are trademarks of Oracle Corporation in the U
version="0.0.0"
unpack="false"/>
-
-
diff --git a/repository/org.eclipse.ice.repository/ice.macosx_product.launch b/repository/org.eclipse.ice.repository/ice.macosx_product.launch
index 57db96555..16731995d 100644
--- a/repository/org.eclipse.ice.repository/ice.macosx_product.launch
+++ b/repository/org.eclipse.ice.repository/ice.macosx_product.launch
@@ -23,7 +23,7 @@
-
+
diff --git a/repository/org.eclipse.ice.repository/ice.product b/repository/org.eclipse.ice.repository/ice.product
index a015ffe50..50ec76426 100644
--- a/repository/org.eclipse.ice.repository/ice.product
+++ b/repository/org.eclipse.ice.repository/ice.product
@@ -143,7 +143,6 @@ Java and all Java-based trademarks are trademarks of Oracle Corporation in the U
-
diff --git a/repository/org.eclipse.ice.repository/ice.product.launch b/repository/org.eclipse.ice.repository/ice.product.launch
index b8bcd2f7c..1e1829831 100644
--- a/repository/org.eclipse.ice.repository/ice.product.launch
+++ b/repository/org.eclipse.ice.repository/ice.product.launch
@@ -22,8 +22,8 @@
-
-
+
+
diff --git a/src/org.eclipse.ice.core/META-INF/MANIFEST.MF b/src/org.eclipse.ice.core/META-INF/MANIFEST.MF
index cf5c133cd..bf3c42794 100644
--- a/src/org.eclipse.ice.core/META-INF/MANIFEST.MF
+++ b/src/org.eclipse.ice.core/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: Core
Bundle-SymbolicName: org.eclipse.ice.core;singleton:=true
Bundle-Version: 2.0.0
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Export-Package: org.eclipse.ice.core.iCore,
org.eclipse.ice.core.launcher
Import-Package: com.google.gson;version="2.2.4",