Author: paperwing
Date: 2012-06-07 10:44:10 -0700 (Thu, 07 Jun 2012)
New Revision: 29498
Modified:
core3/impl/trunk/app-impl/src/main/java/org/cytoscape/app/internal/manager/App.java
core3/impl/trunk/app-impl/src/main/java/org/cytoscape/app/internal/manager/AppManager.java
core3/impl/trunk/app-impl/src/main/java/org/cytoscape/app/internal/manager/BundleApp.java
core3/impl/trunk/app-impl/src/main/java/org/cytoscape/app/internal/manager/SimpleApp.java
Log:
refs #1085 App Manager now properly instances apps that take either a
CyAppAdapter or a CySwingAppAdapter as its argument
Modified:
core3/impl/trunk/app-impl/src/main/java/org/cytoscape/app/internal/manager/App.java
===================================================================
---
core3/impl/trunk/app-impl/src/main/java/org/cytoscape/app/internal/manager/App.java
2012-06-07 17:41:30 UTC (rev 29497)
+++
core3/impl/trunk/app-impl/src/main/java/org/cytoscape/app/internal/manager/App.java
2012-06-07 17:44:10 UTC (rev 29498)
@@ -15,6 +15,7 @@
import org.cytoscape.app.internal.exception.AppInstanceException;
import org.cytoscape.app.internal.exception.AppUninstallException;
import org.cytoscape.app.internal.util.DebugHelper;
+import org.cytoscape.app.swing.CySwingAppAdapter;
/**
* This class represents an app, and contains all needed information about the
app such as its name, version,
@@ -99,7 +100,7 @@
* @throws AppInstanceException If there was an error while instancing
the app, such as not being able to
* locate the class to be instanced.
*/
- public abstract Object createAppInstance(CyAppAdapter appAdapter)
throws AppInstanceException;
+ public abstract Object createAppInstance(CySwingAppAdapter appAdapter)
throws AppInstanceException;
/**
* Installs this app by creating an instance of its class that extends
AbstractCyApp, copying itself
@@ -286,7 +287,7 @@
if (this.getAppInstance() == null) {
Object appInstance;
try {
- appInstance =
createAppInstance(appManager.getAppAdapter());
+ appInstance =
createAppInstance(appManager.getSwingAppAdapter());
} catch (AppInstanceException e) {
throw new AppInstallException("Unable to create
app instance: " + e.getMessage());
}
Modified:
core3/impl/trunk/app-impl/src/main/java/org/cytoscape/app/internal/manager/AppManager.java
===================================================================
---
core3/impl/trunk/app-impl/src/main/java/org/cytoscape/app/internal/manager/AppManager.java
2012-06-07 17:41:30 UTC (rev 29497)
+++
core3/impl/trunk/app-impl/src/main/java/org/cytoscape/app/internal/manager/AppManager.java
2012-06-07 17:44:10 UTC (rev 29498)
@@ -28,6 +28,7 @@
import org.cytoscape.app.internal.net.server.LocalHttpServer;
import org.cytoscape.app.internal.util.DebugHelper;
+import org.cytoscape.app.swing.CySwingAppAdapter;
/**
* This class represents an App Manager, which is capable of maintaining a
list of all currently installed and available apps. The class
@@ -72,9 +73,9 @@
private CyApplicationConfiguration applicationConfiguration;
/**
- * The {@link CyAppAdapter} service reference provided to the
constructor of the app's {@link AbstractCyApp}-implementing class.
+ * The {@link CySwingAppAdapter} service reference provided to the
constructor of the app's {@link AbstractCyApp}-implementing class.
*/
- private CyAppAdapter appAdapter;
+ private CySwingAppAdapter swingAppAdapter;
private FileAlterationMonitor fileAlterationMonitor;
@@ -103,9 +104,9 @@
}
- public AppManager(CyAppAdapter appAdapter, CyApplicationConfiguration
applicationConfiguration, final WebQuerier webQuerier) {
+ public AppManager(CySwingAppAdapter swingAppAdapter,
CyApplicationConfiguration applicationConfiguration, final WebQuerier
webQuerier) {
this.applicationConfiguration = applicationConfiguration;
- this.appAdapter = appAdapter;
+ this.swingAppAdapter = swingAppAdapter;
this.webQuerier = webQuerier;
apps = new HashSet<App>();
@@ -295,8 +296,8 @@
}
}
- public CyAppAdapter getAppAdapter() {
- return appAdapter;
+ public CySwingAppAdapter getSwingAppAdapter() {
+ return swingAppAdapter;
}
public AppParser getAppParser() {
Modified:
core3/impl/trunk/app-impl/src/main/java/org/cytoscape/app/internal/manager/BundleApp.java
===================================================================
---
core3/impl/trunk/app-impl/src/main/java/org/cytoscape/app/internal/manager/BundleApp.java
2012-06-07 17:41:30 UTC (rev 29497)
+++
core3/impl/trunk/app-impl/src/main/java/org/cytoscape/app/internal/manager/BundleApp.java
2012-06-07 17:44:10 UTC (rev 29498)
@@ -6,6 +6,7 @@
import org.cytoscape.app.internal.exception.AppInstallException;
import org.cytoscape.app.internal.exception.AppInstanceException;
import org.cytoscape.app.internal.exception.AppUninstallException;
+import org.cytoscape.app.swing.CySwingAppAdapter;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
@@ -13,7 +14,7 @@
public class BundleApp extends App {
@Override
- public Object createAppInstance(CyAppAdapter appAdapter)
+ public Object createAppInstance(CySwingAppAdapter appAdapter)
throws AppInstanceException {
BundleContext bundleContext = null;
Modified:
core3/impl/trunk/app-impl/src/main/java/org/cytoscape/app/internal/manager/SimpleApp.java
===================================================================
---
core3/impl/trunk/app-impl/src/main/java/org/cytoscape/app/internal/manager/SimpleApp.java
2012-06-07 17:41:30 UTC (rev 29497)
+++
core3/impl/trunk/app-impl/src/main/java/org/cytoscape/app/internal/manager/SimpleApp.java
2012-06-07 17:44:10 UTC (rev 29498)
@@ -11,11 +11,12 @@
import org.cytoscape.app.internal.exception.AppInstallException;
import org.cytoscape.app.internal.exception.AppInstanceException;
import org.cytoscape.app.internal.exception.AppUninstallException;
+import org.cytoscape.app.swing.CySwingAppAdapter;
public class SimpleApp extends App {
@Override
- public Object createAppInstance(CyAppAdapter appAdapter) throws
AppInstanceException {
+ public Object createAppInstance(CySwingAppAdapter appAdapter) throws
AppInstanceException {
File appFile = this.getAppFile();
URL appURL = null;
@@ -42,14 +43,27 @@
// Attempt to obtain the constructor
Constructor<?> constructor = null;
try {
- constructor =
appEntryClass.getConstructor(CyAppAdapter.class);
- } catch (SecurityException e) {
- throw new AppInstanceException("Access to the
constructor for " + appEntryClass + " denied.");
- } catch (NoSuchMethodException e) {
- throw new AppInstanceException("Unable to find a
constructor for " + appEntryClass + " that takes a CyAppAdapter as its
argument.");
+ try {
+ constructor =
appEntryClass.getConstructor(CyAppAdapter.class);
+ } catch (SecurityException e) {
+ throw new AppInstanceException("Access to the
constructor for " + appEntryClass + " denied.");
+ } catch (NoSuchMethodException e) {
+ throw new AppInstanceException("Unable to find
a constructor for " + appEntryClass
+ + " that takes a CyAppAdapter
as its argument.");
+ }
+ } catch (AppInstanceException e) {
+ try {
+ constructor =
appEntryClass.getConstructor(CySwingAppAdapter.class);
+ } catch (SecurityException e2) {
+ throw new AppInstanceException("Access to the
constructor for " + appEntryClass
+ + " taking a CySwingAppAdapter
as its argument denied.");
+ } catch (NoSuchMethodException e2) {
+ throw new AppInstanceException("Unable to find
an accessible constructor that takes either"
+ + " a CyAppAdapter or a
CySwingAppAdapter as its argument.");
+ }
}
- // Attempt to instantiate the app's class that extends
AbstractCyActivator.
+ // Attempt to instantiate the app's class that extends
AbstractCyApp or AbstractCySwingApp.
Object appInstance = null;
try {
appInstance = constructor.newInstance(appAdapter);
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.