Author: tyrell Date: Mon Jul 14 07:53:12 2008 New Revision: 19260 URL: http://wso2.org/svn/browse/wso2?view=rev&revision=19260
Log: Updating the deletion operation to support data service deletion. Modified: trunk/mashup/java/modules/admin/service/src/org/wso2/mashup/admin/service/MashupAdminService.java Modified: trunk/mashup/java/modules/admin/service/src/org/wso2/mashup/admin/service/MashupAdminService.java URL: http://wso2.org/svn/browse/wso2/trunk/mashup/java/modules/admin/service/src/org/wso2/mashup/admin/service/MashupAdminService.java?rev=19260&r1=19259&r2=19260&view=diff ============================================================================== --- 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 Jul 14 07:53:12 2008 @@ -375,7 +375,7 @@ ConfigurationContext configContext = serverManager.configContext; //First try to get the file path from registry - File serviceJs; + File serviceFile; File serviceReources; EmbeddedRegistry embeddedRegistry = @@ -384,8 +384,21 @@ try { UserRegistry systemRegistry = embeddedRegistry.getSystemRegistry(); - serviceJs = new File( - systemRegistry.get(path).getProperty(JavaScriptEngineConstants.SERVICE_JS)); + + Resource res = systemRegistry.get(path); + + if (res.getProperty(JavaScriptEngineConstants.SERVICE_JS) != null) { + // This is a javascript service + serviceFile = new File( + systemRegistry.get(path).getProperty(JavaScriptEngineConstants.SERVICE_JS)); + } else if (res.getProperty(DBConstants.DB_SERVICE_CONFIG_FILE) != null) { + // This is a data service + serviceFile = new File( + systemRegistry.get(path).getProperty(DBConstants.DB_SERVICE_CONFIG_FILE)); + } else { + throw new MashupFault("The service specified for deletion does not exist."); + } + serviceReources = new File( systemRegistry.get(path).getProperty( JavaScriptEngineConstants.RESOURCES_FOLDER)); @@ -403,13 +416,20 @@ path = path + "/" + pathContents[x]; } - serviceJs = new File(configContext.getRealPath(configContext.getContextRoot()) + + serviceFile = new File(configContext.getRealPath(configContext.getContextRoot()) + "/scripts/" + path + ".js"); + + if (!serviceFile.exists()) { + // This might be a data service + serviceFile = new File(configContext.getRealPath(configContext.getContextRoot()) + + "/scripts/" + path + ".dbs"); + } + serviceReources = new File(configContext.getRealPath(configContext.getContextRoot()) + "/scripts/" + path + ".resources"); } - success = serviceJs.delete(); + success = serviceFile.delete(); //On successful deletion of the service, deleting the resources directory if (success) { @@ -835,14 +855,14 @@ char[] decryptedStorePass = new String(cryptoUtil.base64DecodeAndDecrypt(storePassword)).toCharArray(); keyStore.load(ksbufin, decryptedStorePass); - // deleting the certificate entry from keystore + // deleting the certificate entry from keystore keyStore.deleteEntry(alias); OutputStream os = new FileOutputStream(new File(ksInPath)); keyStore.store(os, decryptedStorePass); os.flush(); os.close(); - return Boolean.valueOf(true); + return Boolean.valueOf(true); } catch (IOException e) { throw new MashupFault(e); _______________________________________________ Mashup-dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/mashup-dev
