Author: tyrell
Date: Mon Feb 25 03:44:39 2008
New Revision: 14175
Log:
Fixing MASHUP-686
Modified:
trunk/mashup/java/modules/admin/service/src/org/wso2/mashup/admin/service/MashupAdminService.java
trunk/mashup/java/modules/www/faulty_mashup.jsp
trunk/mashup/java/modules/www/taskbar.jsp
Modified:
trunk/mashup/java/modules/admin/service/src/org/wso2/mashup/admin/service/MashupAdminService.java
==============================================================================
---
trunk/mashup/java/modules/admin/service/src/org/wso2/mashup/admin/service/MashupAdminService.java
(original)
+++
trunk/mashup/java/modules/admin/service/src/org/wso2/mashup/admin/service/MashupAdminService.java
Mon Feb 25 03:44:39 2008
@@ -71,7 +71,7 @@
serviceJs = new File(
registry.get(path).getProperty(JavaScriptEngineConstants.SERVICE_JS));
} catch (RegistryException e) {
-
+
//If the service is not in registry, let's figure out the path
manually by
//extracting the real path from the registry path provided
String[] pathContents = path.split("/");
@@ -312,33 +312,49 @@
return Boolean.valueOf(success);
}
- public Boolean deleteService(String serviceName) throws MashupFault {
+ public Boolean deleteService(String path) throws MashupFault {
boolean success = false;
- MessageContext currentMessageContext =
MessageContext.getCurrentMessageContext();
- AxisConfiguration configuration =
- currentMessageContext.getAxisService().getAxisConfiguration();
+ ServerManager serverManager = ServerManager.getInstance();
+ ConfigurationContext configContext = serverManager.configContext;
+
+ //First try to get the file path from registry
+ File serviceJs;
+ File serviceReources;
+ JDBCRegistry registry =
+ (JDBCRegistry)
configContext.getAxisConfiguration().getParameterValue(
+ RegistryConstants.REGISTRY);
try {
- AxisService mashupService = configuration.getService(serviceName);
+ serviceJs = new File(
+
registry.get(path).getProperty(JavaScriptEngineConstants.SERVICE_JS));
+ serviceReources = new File(
+
registry.get(path).getProperty(JavaScriptEngineConstants.RESOURCES_FOLDER));
- Parameter serviceJSParameter = mashupService
- .getParameter(JavaScriptEngineConstants.SERVICE_JS);
- Parameter serviceResourcesDir =
-
mashupService.getParameter(JavaScriptEngineConstants.RESOURCES_FOLDER);
+ //Removing this service from the registry
+ registry.delete(path);
- if (serviceJSParameter != null && serviceJSParameter.getValue() !=
null) {
- File serviceJS = (File) serviceJSParameter.getValue();
- File serviceReources = (File) serviceResourcesDir.getValue();
- success = serviceJS.delete();
+ } catch (RegistryException e) {
- //On successful deletion of the service, deleting the
resources directory
- if (success) {
- success = deleteDir(serviceReources);
- }
+ //If the service is not in registry, let's figure out the path
manually by
+ //extracting the real path from the registry path provided
+ String[] pathContents = path.split("/");
+ path = "";
+ for (int x = 2; x < pathContents.length; x++) {
+ path = path + "/" + pathContents[x];
}
- } catch (Exception e) {
- throw new MashupFault("Cannot delete service " + serviceName, e);
+
+ serviceJs = new
File(configContext.getRealPath(configContext.getContextRoot()) +
+ "/scripts/" + path + ".js");
+ serviceReources = new
File(configContext.getRealPath(configContext.getContextRoot()) +
+ "/scripts/" + path + ".resources");
+ }
+
+ success = serviceJs.delete();
+
+ //On successful deletion of the service, deleting the resources
directory
+ if (success) {
+ success = deleteDir(serviceReources);
}
return Boolean.valueOf(success);
Modified: trunk/mashup/java/modules/www/faulty_mashup.jsp
==============================================================================
--- trunk/mashup/java/modules/www/faulty_mashup.jsp (original)
+++ trunk/mashup/java/modules/www/faulty_mashup.jsp Mon Feb 25 03:44:39 2008
@@ -34,11 +34,20 @@
%>
<html>
<head>
- <title><%= bundle.getString("main.title")%> - Details of the faulty mashup
'<%=mashup%>' by <%=author%>
+ <title><%= bundle.getString("main.title")%> - Details of the faulty mashup
'<%=mashup%>'
+ by <%=author%>
</title>
<!-- Required CSS -->
<link href="css/styles.css" rel="stylesheet" type="text/css"/>
<script language="javascript" src="js/common.js"
type="text/javascript"></script>
+ <!--WSO2 Dependencies-->
+ <script type="text/javascript"
src="../wsasadmin/global_params.js"></script>
+ <script type="text/javascript" src="../wsasadmin/js/main.js"></script>
+ <script type="text/javascript" src="js/wso2/WSRequest.js"></script>
+ <script type="text/javascript" src="js/mashup-main.js"></script>
+ <script type="text/javascript" src="js/services.js"></script>
+ <script type="text/javascript" src="js/mashup.js"></script>
+ <script type="text/javascript" src="js/mashup-utils.js"></script>
</head>
<body>
<div id="page">
@@ -54,16 +63,30 @@
</i> authored by <i><%=authorFullName%> (<%=author%>)</i> has been
marked as faulty by the system.
<%
-
if (RegistryUtils.isLoggedIn(registry)) {
// Will be available only to users with Admin priviledges
OR who are Authors of the current Mashup
if ((RegistryUtils.isAdminRole(registry)) ||
(author.equalsIgnoreCase(currentUser))) {
-
%>
+
+ <script type="text/javascript" language="JavaScript">
+ function deleteServiceCallback() {
+ window.location = "index.jsp";
+ }
+
+ function deleteMashup() {
+
+ var confirmation = confirm("You are about to permanently
delete the '<%=mashup%>' mashup. Are you sure?")
+
+ if (confirmation) {
+ wso2.mashup.services.deleteService('<%=path%>',
deleteServiceCallback);
+ }
+ }
+ </script>
+
You may use the <a
href="editor.jsp?action=edit&mashup=<%=path%>">mashup editor</a> to
- fix
- the source code of this mashup.
+ fix the source code of this mashup. You can also <a href="#"
onclick="deleteMashup();">delete</a>
+ this mashup from the system.
<p>The following details regarding the faulty mashup is available at
this time.</p>
@@ -79,7 +102,6 @@
<%
}
%>
- </p>
</div>
<%@ include file="footer.jsp" %>
</div>
Modified: trunk/mashup/java/modules/www/taskbar.jsp
==============================================================================
--- trunk/mashup/java/modules/www/taskbar.jsp (original)
+++ trunk/mashup/java/modules/www/taskbar.jsp Mon Feb 25 03:44:39 2008
@@ -95,7 +95,7 @@
var confirmation = confirm("You are about to permanently delete the
'<%=paramMashupServiceName%>' service. Are you sure?")
if (confirmation) {
- wso2.mashup.services.deleteService('<%=paramMashupServiceName%>',
deleteServiceCallback);
+ wso2.mashup.services.deleteService('<%=paramPath%>',
deleteServiceCallback);
}
}
@@ -151,12 +151,7 @@
//Enabling service sharing
document.getElementById("share-mashup").innerHTML =
' <a href="#"
onclick="WSO2.MashupUtils.showMashupSharingDialog(\'<%=paramMashupServiceName%>\');">Share
this mashup</a>';
- //Enabling service deletion
- var delElem = document.getElementById("delete-service");
- if (!(delElem == "undefined")) {
- delElem.innerHTML =
- ' <a href="#" onclick="deleteService();">Delete this
service</a>';
- }
+
} else {
document.getElementById("service-status").innerHTML =
"Service stopped. [<a href='#'
onclick='WSO2.MashupUtils.handleServiceStartStop(\"<%=paramMashupServiceName%>\",
true, handleServiceStartStopCallback)'>Start</a>]";
@@ -166,11 +161,6 @@
//Disabling service sharing
document.getElementById("share-mashup").innerHTML =
"Service sharing is not available";
- //Disabling service deletion
- delElem = document.getElementById("delete-service");
- if (!(delElem == "undefined")) {
- delElem.innerHTML = "Service deletion is not available";
- }
}
}
@@ -197,12 +187,7 @@
//Enabling service sharing
document.getElementById("share-mashup").innerHTML =
' <a href="#"
onclick="WSO2.MashupUtils.showMashupSharingDialog(\'<%=paramMashupServiceName%>\');">Share
this mashup</a>';
- //Enabling service deletion
- var delElem = document.getElementById("delete-service");
- if (!(delElem == "undefined")) {
- delElem.innerHTML =
- ' <a href="#" onclick="deleteService();">Delete this
service</a>';
- }
+
} else {
document.getElementById("service-status").innerHTML =
"Service stopped. [<a href='#'
onclick='WSO2.MashupUtils.handleServiceStartStop(\"<%=paramMashupServiceName%>\",
true, handleServiceStartStopCallback)'>Start</a>]";
@@ -212,11 +197,7 @@
//Disabling service sharing
document.getElementById("share-mashup").innerHTML =
"Service sharing is not available";
- //Disabling service deletion
- delElem = document.getElementById("delete-service");
- if (!(delElem == "undefined")) {
- delElem.innerHTML = "Service deletion is not available";
- }
+
}
}
_______________________________________________
Mashup-dev mailing list
[email protected]
http://www.wso2.org/cgi-bin/mailman/listinfo/mashup-dev