@ -37,7 +37,6 @@ import org.slf4j.LoggerFactory;
import com.google.gwt.user.server.rpc.RemoteServiceServlet ;
import com.liferay.portal.service.UserLocalServiceUtil ;
// TODO: Auto-generated Javadoc
/ * *
* The server side implementation of the RPC service .
@ -133,23 +132,24 @@ public class ThreddsWorkspaceSyncServiceImpl extends RemoteServiceServlet implem
GCubeUser user = PortalContext . getConfiguration ( ) . getCurrentUser ( this . getThreadLocalRequest ( ) ) ;
return getConfiguration ( folderId , loadStatus , this . getThreadLocalRequest ( ) , user ) ;
}
/ * *
* Gets the configuration .
*
* @param folderId the folder id
* @param loadStatus the load status
* @param folderId the folder id
* @param loadStatus the load status
* @param httpRequest the http request
* @param user the user
* @param user the user
* @return the configuration
* @throws Exception the exception
* /
public WsThreddsSynchFolderDescriptor getConfiguration ( String folderId , boolean loadStatus , HttpServletRequest httpRequest , GCubeUser user ) throws Exception {
public WsThreddsSynchFolderDescriptor getConfiguration ( String folderId , boolean loadStatus ,
HttpServletRequest httpRequest , GCubeUser user ) throws Exception {
logger . debug ( "called internal getConfiguration for folderId: " + folderId ) ;
try {
ThSyncFolderDescriptor theConfig = getSyncService ( ) . getConfiguration ( folderId , loadStatus , httpRequest , user ) ;
ThSyncFolderDescriptor theConfig = getSyncService ( ) . getConfiguration ( folderId , loadStatus , httpRequest ,
user ) ;
if ( theConfig ! = null ) {
logger . info ( "Folder id: " + folderId + " is synched" ) ;
@ -197,10 +197,11 @@ public class ThreddsWorkspaceSyncServiceImpl extends RemoteServiceServlet implem
config = BeanConverter . toThSynchFolderConfiguration ( clientConfig , folderId ,
clientConfig . getSelectedScope ( ) . getScopeName ( ) ) ;
logger . debug ( "Creating server config " + config ) ;
} else {
} else {
logger . info ( "The config sent from client is null, Loading it from ws-thredds" ) ;
ThSyncFolderDescriptor descr = getSyncService ( ) . getConfiguration ( folderId , false , this . getThreadLocalRequest ( ) , user ) ;
logger . info ( "From ws-thredds loaded the config: " + config ) ;
ThSyncFolderDescriptor descr = getSyncService ( ) . getConfiguration ( folderId , false ,
this . getThreadLocalRequest ( ) , user ) ;
logger . info ( "From ws-thredds loaded the config: " + config ) ;
config = descr . getConfiguration ( ) ;
}
@ -210,7 +211,10 @@ public class ThreddsWorkspaceSyncServiceImpl extends RemoteServiceServlet implem
return status ;
} catch ( Exception e ) {
logger . error ( "Do sync Folder error: " , e ) ;
throw new Exception ( "Sorry, an error occurred during synchonization phase. The server encountered the error: " + e . getMessage ( ) , e ) ;
throw new Exception (
"Sorry, an error occurred during synchonization phase. The server encountered the error: "
+ e . getMessage ( ) ,
e ) ;
}
}
@ -228,7 +232,8 @@ public class ThreddsWorkspaceSyncServiceImpl extends RemoteServiceServlet implem
try {
GCubeUser user = PortalContext . getConfiguration ( ) . getCurrentUser ( this . getThreadLocalRequest ( ) ) ;
ThSyncFolderDescriptor foldeDesr = getSyncService ( ) . getConfiguration ( folderId , false , this . getThreadLocalRequest ( ) , user ) ;
ThSyncFolderDescriptor foldeDesr = getSyncService ( ) . getConfiguration ( folderId , false ,
this . getThreadLocalRequest ( ) , user ) ;
return getSyncService ( ) . doUnSync ( folderId , true , foldeDesr . getConfiguration ( ) , this . getThreadLocalRequest ( ) ,
user ) ;
} catch ( Exception e ) {
@ -249,7 +254,6 @@ public class ThreddsWorkspaceSyncServiceImpl extends RemoteServiceServlet implem
public Map < String , GatewayRolesThredds > getScopesWithThreddsRolesForLoggedUser ( ) throws Exception {
logger . info ( "called getScopesWithThreddsRolesForLoggedUser" ) ;
GCubeUser user = null ;
Map < String , GatewayRolesThredds > mapScopesRoles = null ;
// DEV MODE
@ -260,11 +264,13 @@ public class ThreddsWorkspaceSyncServiceImpl extends RemoteServiceServlet implem
// mapScopesRoles.put( "/gcube/devNext/NextNext", GatewayRolesThredds.THREDDS_PUBLISHER);
return mapScopesRoles ;
}
GCubeUser user = null ;
try {
user = PortalContext . getConfiguration ( ) . getCurrentUser ( this . getThreadLocalRequest ( ) ) ;
mapScopesRoles = WsUtil . getScopesWithThreddsRolesForUser ( user ) ;
String gatewayHostname = GenericUtils . getGatewayClientHostname ( this . getThreadLocalRequest ( ) ) ;
mapScopesRoles = WsUtil . getScopesWithThreddsRolesForUser ( user , gatewayHostname ) ;
logger . info ( "returning Map(scopes,roles): " + mapScopesRoles ) ;
return mapScopesRoles ;