nikolas.laskaris 2014-06-03 14:06:52 +00:00
parent e7e5ca1f41
commit c103b97609
5 changed files with 535 additions and 611 deletions

View File

@ -17,13 +17,13 @@
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> <classpathentry exported="true" kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.nondependency" value=""/> <attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"> <classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>

77
pom.xml
View File

@ -43,7 +43,7 @@
<dependency> <dependency>
<groupId>org.gcube.dvos</groupId> <groupId>org.gcube.dvos</groupId>
<artifactId>usermanagement-stub</artifactId> <artifactId>usermanagement-stub</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version> <version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
</dependency> </dependency>
<dependency> <dependency>
@ -97,85 +97,12 @@
<version>2.3.0</version> <version>2.3.0</version>
</dependency> </dependency>
<!-- <!--
<dependency>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
<version>2.6.0</version>
</dependency>
-->
<dependency> <dependency>
<groupId>net.sourceforge.addressing</groupId> <groupId>net.sourceforge.addressing</groupId>
<artifactId>addressing</artifactId> <artifactId>addressing</artifactId>
<version>1.1.1</version> <version>1.1.1</version>
</dependency> </dependency>
-->
<dependency>
<groupId>org.gcube.informationsystem</groupId>
<artifactId>iscache</artifactId>
<version>[1.2.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
</dependency>
<!--
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.xml.rpc</artifactId>
<version>3.1.1</version>
</dependency>
<dependency>
<groupId>org.gcube.resources</groupId>
<artifactId>common-gcore-resources</artifactId>
</dependency>
<dependency>
<groupId>backport-util-concurrent</groupId>
<artifactId>backport-util-concurrent</artifactId>
</dependency>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-scope</artifactId>
</dependency>
<dependency>
<groupId>org.gcube.dvos.soa3</groupId>
<artifactId>gcube-security-utils</artifactId>
<version>0.1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-scope</artifactId>
</dependency>
<dependency>
<groupId>org.gcube.resources.discovery</groupId>
<artifactId>ic-client</artifactId>
<version>[1.0.1-SNAPSHOT,2.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-gcore-stubs</artifactId>
</dependency>
<dependency>
<groupId>org.gcube.resources</groupId>
<artifactId>common-gcore-resources</artifactId>
</dependency>
<dependency>
<groupId>org.gcube.personalisation</groupId>
<artifactId>profileadministration-client-library</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.gcube.personalisation</groupId>
<artifactId>userprofileaccess-client-library</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
-->
</dependencies> </dependencies>

View File

@ -1,96 +1,96 @@
package org.gcube.application.framework.core.cache; //package org.gcube.application.framework.core.cache;
//
import java.util.HashMap; //import java.util.HashMap;
//import org.gcube.common.core.scope.GCUBEScope; ////import org.gcube.common.core.scope.GCUBEScope;
//import org.gcube.common.core.utils.logging.GCUBELog; ////import org.gcube.common.core.utils.logging.GCUBELog;
////import org.gcube.informationsystem.cache.ISCache;
////import org.gcube.informationsystem.cache.ISCacheManager;
//import net.sf.ehcache.Cache;
//import net.sf.ehcache.CacheManager;
//
//import org.gcube.informationsystem.cache.ISCache; //import org.gcube.informationsystem.cache.ISCache;
//import org.gcube.informationsystem.cache.ISCacheManager; //import org.gcube.informationsystem.cache.ISCacheManager;
import net.sf.ehcache.Cache; //import org.gcube.resources.discovery.icclient.ICClient;
import net.sf.ehcache.CacheManager; //import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
import org.gcube.informationsystem.cache.ISCache; //
import org.gcube.informationsystem.cache.ISCacheManager; //
import org.gcube.resources.discovery.icclient.ICClient; ///**
import org.slf4j.Logger; // * This class manages the running harvester threads.
import org.slf4j.LoggerFactory; // *
// * @author Valia Tsagkalidou (KNUA)
// *
/** // */
* This class manages the running harvester threads. //
* //public class RIsManager {
* @author Valia Tsagkalidou (KNUA) //
* //
*/ // /**
// * Defines the manager's instance
public class RIsManager { // */
// private static RIsManager instance = null;
//
/** // /**
* Defines the manager's instance // * keeps the ISCache per scope
*/ // */
private static RIsManager instance = null; //
//// protected HashMap<String, ISCache> isCaches;
/** //
* keeps the ISCache per scope // protected HashMap<String, ISCache> caches; //(scope,iccache) pairs
*/ //
// /** Object logger. */
// protected HashMap<String, ISCache> isCaches; //
// protected static final Logger logger = LoggerFactory.getLogger(RIsManager.class);
protected HashMap<String, ISCache> caches; //(scope,iccache) pairs //
// /**
/** Object logger. */ // * Initializes RIsManager
// */
protected static final Logger logger = LoggerFactory.getLogger(RIsManager.class); // private RIsManager() {
//// caches = new HashMap<String, ISCache>();
/** // }
* Initializes RIsManager //
*/ // /**
private RIsManager() { // * Retrieves the singleton
caches = new HashMap<String, ISCache>(); // * @return the only instance of RIsManager
} // */
// synchronized public static RIsManager getInstance() {
/** // if (instance == null)
* Retrieves the singleton // instance = new RIsManager();
* @return the only instance of RIsManager // return instance;
*/ // }
synchronized public static RIsManager getInstance() { //
if (instance == null) //
instance = new RIsManager(); // /**
return instance; // * @param scope the GGUBEScope for which the RIs are requested
} // * @return the ISCache for this specific scope
// */
// public synchronized ISCache getISCache(String scope)
/** // {
* @param scope the GGUBEScope for which the RIs are requested // ISCache info = caches.get(scope);
* @return the ISCache for this specific scope //
*/ //// TODO: UNCOMMENT when ISCache is FeatherWeight Stack compatible
public synchronized ISCache getISCache(String scope) //
{ //// if(info == null)
ISCache info = caches.get(scope); //// {
//// // If the ISCache in not already created, then it creates a new instance and adds it to the HashMap
// TODO: UNCOMMENT when ISCache is FeatherWeight Stack compatible //// try {
//// ISCacheManager.addManager(scope);
// if(info == null) //// info = ISCacheManager.getCacheManager(scope).getManager(scope).getCache();
// { //// caches.put(scope, info);
// // If the ISCache in not already created, then it creates a new instance and adds it to the HashMap //// try {
// try { //// Thread.sleep(5000);
// ISCacheManager.addManager(scope); //// } catch (InterruptedException e1) {
// info = ISCacheManager.getCacheManager(scope).getManager(scope).getCache(); //// logger.error("", e1);
// caches.put(scope, info); //// }
// try { //// } catch (Exception e) {
// Thread.sleep(5000); //// logger.error("", e);
// } catch (InterruptedException e1) { //// }
// logger.error("", e1); //// }
// } //
// } catch (Exception e) { // logger.debug("RI in cache is probably null");
// logger.error("", e); // logger.info("RI in cache is probably null");
// } //
// } // return info;
// }
logger.debug("RI in cache is probably null"); //
logger.info("RI in cache is probably null"); //}
return info;
}
}

View File

@ -1,437 +1,437 @@
package org.gcube.application.framework.core.security; //package org.gcube.application.framework.core.security;
//
import java.io.BufferedReader; //import java.io.BufferedReader;
import java.io.File; //import java.io.File;
import java.io.FileNotFoundException; //import java.io.FileNotFoundException;
import java.io.FileReader; //import java.io.FileReader;
import java.io.IOException; //import java.io.IOException;
import java.rmi.RemoteException; //import java.rmi.RemoteException;
import java.util.ArrayList; //import java.util.ArrayList;
import java.util.List; //import java.util.List;
//
import javax.xml.rpc.ServiceException; //import javax.xml.rpc.ServiceException;
//
import org.apache.axis.message.addressing.AttributedURI; //import org.apache.axis.message.addressing.AttributedURI;
import org.apache.axis.message.addressing.EndpointReferenceType; //import org.apache.axis.message.addressing.EndpointReferenceType;
import org.apache.axis.types.URI.MalformedURIException; //import org.apache.axis.types.URI.MalformedURIException;
import org.gcube.application.framework.core.session.ASLSession; //import org.gcube.application.framework.core.session.ASLSession;
import org.gcube.application.framework.core.util.ASLGroupModel; //import org.gcube.application.framework.core.util.ASLGroupModel;
import org.gcube.application.framework.core.util.Settings; //import org.gcube.application.framework.core.util.Settings;
import org.gcube.application.framework.core.util.UsersManagementServiceConstants; //import org.gcube.application.framework.core.util.UsersManagementServiceConstants;
import org.gcube.vomanagement.usermanagement.ws.GetGroupParentId; //import org.gcube.vomanagement.usermanagement.ws.GetGroupParentId;
import org.gcube.vomanagement.usermanagement.ws.GetRootVO; //import org.gcube.vomanagement.usermanagement.ws.GetRootVO;
import org.gcube.vomanagement.usermanagement.ws.GetScope; //import org.gcube.vomanagement.usermanagement.ws.GetScope;
import org.gcube.vomanagement.usermanagement.ws.GetUserId; //import org.gcube.vomanagement.usermanagement.ws.GetUserId;
import org.gcube.vomanagement.usermanagement.ws.GroupModel; //import org.gcube.vomanagement.usermanagement.ws.GroupModel;
import org.gcube.vomanagement.usermanagement.ws.GroupRetrievalFault; //import org.gcube.vomanagement.usermanagement.ws.GroupRetrievalFault;
import org.gcube.vomanagement.usermanagement.ws.IsRootVO; //import org.gcube.vomanagement.usermanagement.ws.IsRootVO;
import org.gcube.vomanagement.usermanagement.ws.IsVO; //import org.gcube.vomanagement.usermanagement.ws.IsVO;
import org.gcube.vomanagement.usermanagement.ws.LiferaySOAPGroupManagerPortType; //import org.gcube.vomanagement.usermanagement.ws.LiferaySOAPGroupManagerPortType;
import org.gcube.vomanagement.usermanagement.ws.LiferaySOAPUserManagerPortType; //import org.gcube.vomanagement.usermanagement.ws.LiferaySOAPUserManagerPortType;
import org.gcube.vomanagement.usermanagement.ws.ListGroups; //import org.gcube.vomanagement.usermanagement.ws.ListGroups;
import org.gcube.vomanagement.usermanagement.ws.ListGroupsByUser; //import org.gcube.vomanagement.usermanagement.ws.ListGroupsByUser;
import org.gcube.vomanagement.usermanagement.ws.ListGroupsResponse; //import org.gcube.vomanagement.usermanagement.ws.ListGroupsResponse;
import org.gcube.vomanagement.usermanagement.ws.UserManagementSystemException; //import org.gcube.vomanagement.usermanagement.ws.UserManagementSystemException;
import org.gcube.vomanagement.usermanagement.ws.service.LiferaySOAPGroupManagerServiceAddressingLocator; //import org.gcube.vomanagement.usermanagement.ws.service.LiferaySOAPGroupManagerServiceAddressingLocator;
import org.gcube.vomanagement.usermanagement.ws.service.LiferaySOAPUserManagerServiceAddressingLocator; //import org.gcube.vomanagement.usermanagement.ws.service.LiferaySOAPUserManagerServiceAddressingLocator;
//
import org.slf4j.Logger; //import org.slf4j.Logger;
import org.slf4j.LoggerFactory; //import org.slf4j.LoggerFactory;
//
public class UsersManagementUtils { //public class UsersManagementUtils {
//
/** The logger. */ // /** The logger. */
private static final Logger logger = LoggerFactory.getLogger(UsersManagementUtils.class); // private static final Logger logger = LoggerFactory.getLogger(UsersManagementUtils.class);
//
String umServiceLocation = new String(); // String umServiceLocation = new String();
//
public UsersManagementUtils() { // public UsersManagementUtils() {
StringBuffer fileData = new StringBuffer(1000); // StringBuffer fileData = new StringBuffer(1000);
BufferedReader reader = null; // BufferedReader reader = null;
try { // try {
reader = new BufferedReader(new FileReader(Settings.getInstance().getProperty("sharedDir")+ File.separator + "UMServiceLocation.config")); // reader = new BufferedReader(new FileReader(Settings.getInstance().getProperty("sharedDir")+ File.separator + "UMServiceLocation.config"));
} catch (FileNotFoundException e) { // } catch (FileNotFoundException e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} // }
int numRead = 0; // int numRead = 0;
char[] buf = new char[1024]; // char[] buf = new char[1024];
try { // try {
while((numRead=reader.read(buf)) != -1){ // while((numRead=reader.read(buf)) != -1){
String readData = String.valueOf(buf, 0, numRead); // String readData = String.valueOf(buf, 0, numRead);
fileData.append(readData); // fileData.append(readData);
buf = new char[1024]; // buf = new char[1024];
} // }
} catch (IOException e) { // } catch (IOException e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} // }
try { // try {
reader.close(); // reader.close();
} catch (IOException e) { // } catch (IOException e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} // }
umServiceLocation = fileData.toString().trim(); // umServiceLocation = fileData.toString().trim();
} // }
//
public ArrayList<String> getAllScopes(ASLSession session) { // public ArrayList<String> getAllScopes(ASLSession session) {
EndpointReferenceType endpointUser = new EndpointReferenceType(); // EndpointReferenceType endpointUser = new EndpointReferenceType();
ArrayList<String> groupsNames = new ArrayList<String>(); // ArrayList<String> groupsNames = new ArrayList<String>();
try { // try {
//endpointUser.setAddress(new AttributedURI("http://dl10.di.uoa.gr:8181/usermanagement-ws/LiferaySOAPGroupManager")); // //endpointUser.setAddress(new AttributedURI("http://dl10.di.uoa.gr:8181/usermanagement-ws/LiferaySOAPGroupManager"));
endpointUser.setAddress(new AttributedURI(umServiceLocation + UsersManagementServiceConstants.LiferaySOAPGroupManager)); // endpointUser.setAddress(new AttributedURI(umServiceLocation + UsersManagementServiceConstants.LiferaySOAPGroupManager));
} catch (MalformedURIException e) { // } catch (MalformedURIException e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} // }
LiferaySOAPGroupManagerServiceAddressingLocator loc = new LiferaySOAPGroupManagerServiceAddressingLocator(); // LiferaySOAPGroupManagerServiceAddressingLocator loc = new LiferaySOAPGroupManagerServiceAddressingLocator();
try { // try {
LiferaySOAPGroupManagerPortType groupStub = loc.getLiferaySOAPGroupManagerPortTypePort(endpointUser); // LiferaySOAPGroupManagerPortType groupStub = loc.getLiferaySOAPGroupManagerPortTypePort(endpointUser);
ListGroups groups = new ListGroups(); // ListGroups groups = new ListGroups();
//
ListGroupsResponse resGroup = groupStub.listGroups(groups); // ListGroupsResponse resGroup = groupStub.listGroups(groups);
//
GroupModel[] groupList = resGroup.get_return(); // GroupModel[] groupList = resGroup.get_return();
//
for (GroupModel groupModel : groupList) { // for (GroupModel groupModel : groupList) {
logger.info("Group NAME " + groupModel.getGroupName()); // logger.info("Group NAME " + groupModel.getGroupName());
//
GetRootVO rootVO = new GetRootVO(); // GetRootVO rootVO = new GetRootVO();
if (!groupStub.getRootVO(rootVO).get_return().getGroupId().equals(groupModel.getGroupId())) { // if (!groupStub.getRootVO(rootVO).get_return().getGroupId().equals(groupModel.getGroupId())) {
String scope = null; // String scope = null;
//
GetScope getScope = new GetScope(); // GetScope getScope = new GetScope();
getScope.setArg0(groupModel.getGroupId()); // getScope.setArg0(groupModel.getGroupId());
scope = groupStub.getScope(getScope).get_return(); // scope = groupStub.getScope(getScope).get_return();
//
if (scope.startsWith("/")) // if (scope.startsWith("/"))
groupsNames.add(scope); // groupsNames.add(scope);
} // }
} // }
//
} catch (ServiceException e) { // } catch (ServiceException e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} catch (UserManagementSystemException e) { // } catch (UserManagementSystemException e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} catch (RemoteException e) { // } catch (RemoteException e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} // }
//
return groupsNames; // return groupsNames;
//
} // }
//
//
public String getRootVO() { // public String getRootVO() {
//
EndpointReferenceType endpointUser = new EndpointReferenceType(); // EndpointReferenceType endpointUser = new EndpointReferenceType();
ArrayList<String> groupsNames = new ArrayList<String>(); // ArrayList<String> groupsNames = new ArrayList<String>();
try { // try {
//endpointUser.setAddress(new AttributedURI("http://dl10.di.uoa.gr:8181/usermanagement-ws/LiferaySOAPGroupManager")); // //endpointUser.setAddress(new AttributedURI("http://dl10.di.uoa.gr:8181/usermanagement-ws/LiferaySOAPGroupManager"));
endpointUser.setAddress(new AttributedURI(umServiceLocation + UsersManagementServiceConstants.LiferaySOAPGroupManager)); // endpointUser.setAddress(new AttributedURI(umServiceLocation + UsersManagementServiceConstants.LiferaySOAPGroupManager));
} catch (MalformedURIException e) { // } catch (MalformedURIException e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} // }
//
LiferaySOAPGroupManagerServiceAddressingLocator loc = new LiferaySOAPGroupManagerServiceAddressingLocator(); // LiferaySOAPGroupManagerServiceAddressingLocator loc = new LiferaySOAPGroupManagerServiceAddressingLocator();
LiferaySOAPGroupManagerPortType groupStub = null; // LiferaySOAPGroupManagerPortType groupStub = null;
try { // try {
groupStub = loc.getLiferaySOAPGroupManagerPortTypePort(endpointUser); // groupStub = loc.getLiferaySOAPGroupManagerPortTypePort(endpointUser);
} catch (ServiceException e) { // } catch (ServiceException e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} // }
ListGroups groups = new ListGroups(); // ListGroups groups = new ListGroups();
//
try { // try {
ListGroupsResponse resGroup = groupStub.listGroups(groups); // ListGroupsResponse resGroup = groupStub.listGroups(groups);
} catch (UserManagementSystemException e) { // } catch (UserManagementSystemException e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} catch (RemoteException e) { // } catch (RemoteException e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} // }
//
GetRootVO rootVO = new GetRootVO(); // GetRootVO rootVO = new GetRootVO();
try { // try {
String rootVo = groupStub.getRootVO(rootVO).get_return().getGroupId(); // String rootVo = groupStub.getRootVO(rootVO).get_return().getGroupId();
String rootVoName = getScope(rootVo); // String rootVoName = getScope(rootVo);
logger.info("RootVo returning: " + rootVoName); // logger.info("RootVo returning: " + rootVoName);
return rootVoName; // return rootVoName;
} catch (GroupRetrievalFault e) { // } catch (GroupRetrievalFault e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} catch (UserManagementSystemException e) { // } catch (UserManagementSystemException e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} catch (RemoteException e) { // } catch (RemoteException e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} // }
//
return null; // return null;
} // }
//
//
public String getUserId(String username) { // public String getUserId(String username) {
EndpointReferenceType endpointUser = new EndpointReferenceType(); // EndpointReferenceType endpointUser = new EndpointReferenceType();
String userId = null; // String userId = null;
try { // try {
//endpointUser.setAddress(new AttributedURI("http://dl10.di.uoa.gr:8181/usermanagement-ws/LiferaySOAPUserManager")); // //endpointUser.setAddress(new AttributedURI("http://dl10.di.uoa.gr:8181/usermanagement-ws/LiferaySOAPUserManager"));
endpointUser.setAddress(new AttributedURI(umServiceLocation + UsersManagementServiceConstants.LiferaySOAPUserManager)); // endpointUser.setAddress(new AttributedURI(umServiceLocation + UsersManagementServiceConstants.LiferaySOAPUserManager));
//
try { // try {
LiferaySOAPUserManagerPortType userManagerStub = new LiferaySOAPUserManagerServiceAddressingLocator().getLiferaySOAPUserManagerPortTypePort(endpointUser); // LiferaySOAPUserManagerPortType userManagerStub = new LiferaySOAPUserManagerServiceAddressingLocator().getLiferaySOAPUserManagerPortTypePort(endpointUser);
GetUserId getUserId = new GetUserId(); // GetUserId getUserId = new GetUserId();
getUserId.setArg0(username); // getUserId.setArg0(username);
userId = userManagerStub.getUserId(getUserId).get_return(); // userId = userManagerStub.getUserId(getUserId).get_return();
} catch (ServiceException e) { // } catch (ServiceException e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} catch (UserManagementSystemException e) { // } catch (UserManagementSystemException e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} catch (RemoteException e) { // } catch (RemoteException e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} // }
//
} catch (MalformedURIException e) { // } catch (MalformedURIException e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} // }
return userId; // return userId;
} // }
//
//
public List<ASLGroupModel> listGroupsByUser(String userId) { // public List<ASLGroupModel> listGroupsByUser(String userId) {
EndpointReferenceType endpointUser = new EndpointReferenceType(); // EndpointReferenceType endpointUser = new EndpointReferenceType();
List<ASLGroupModel> groupsByUser = new ArrayList<ASLGroupModel>(); // List<ASLGroupModel> groupsByUser = new ArrayList<ASLGroupModel>();
try { // try {
//endpointUser.setAddress(new AttributedURI("http://dl10.di.uoa.gr:8181/usermanagement-ws/LiferaySOAPGroupManager")); // //endpointUser.setAddress(new AttributedURI("http://dl10.di.uoa.gr:8181/usermanagement-ws/LiferaySOAPGroupManager"));
endpointUser.setAddress(new AttributedURI(umServiceLocation + UsersManagementServiceConstants.LiferaySOAPGroupManager)); // endpointUser.setAddress(new AttributedURI(umServiceLocation + UsersManagementServiceConstants.LiferaySOAPGroupManager));
} catch (MalformedURIException e) { // } catch (MalformedURIException e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} // }
LiferaySOAPGroupManagerServiceAddressingLocator loc = new LiferaySOAPGroupManagerServiceAddressingLocator(); // LiferaySOAPGroupManagerServiceAddressingLocator loc = new LiferaySOAPGroupManagerServiceAddressingLocator();
try { // try {
LiferaySOAPGroupManagerPortType groupStub = loc.getLiferaySOAPGroupManagerPortTypePort(endpointUser); // LiferaySOAPGroupManagerPortType groupStub = loc.getLiferaySOAPGroupManagerPortTypePort(endpointUser);
ListGroupsByUser listGroupsByUser = new ListGroupsByUser(); // ListGroupsByUser listGroupsByUser = new ListGroupsByUser();
listGroupsByUser.setArg0(userId); // listGroupsByUser.setArg0(userId);
GroupModel[] groups = groupStub.listGroupsByUser(listGroupsByUser).get_return(); // GroupModel[] groups = groupStub.listGroupsByUser(listGroupsByUser).get_return();
if(groups==null) // if(groups==null)
logger.debug("User is in no group."); // logger.debug("User is in no group.");
for (int i = 0; i < groups.length; i++) { // for (int i = 0; i < groups.length; i++) {
ASLGroupModel grm = new ASLGroupModel(); // ASLGroupModel grm = new ASLGroupModel();
grm.setGroupId(new Long(groups[i].getGroupId())); // grm.setGroupId(new Long(groups[i].getGroupId()));
grm.setGroupName(groups[i].getGroupName()); // grm.setGroupName(groups[i].getGroupName());
grm.setDescription(groups[i].getDescription()); // grm.setDescription(groups[i].getDescription());
groupsByUser.add(grm); // groupsByUser.add(grm);
} // }
//
} catch (ServiceException e) { // } catch (ServiceException e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} catch (UserManagementSystemException e) { // } catch (UserManagementSystemException e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} catch (RemoteException e) { // } catch (RemoteException e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} // }
//
return groupsByUser; // return groupsByUser;
} // }
//
//
public List<ASLGroupModel> listGroups() { // public List<ASLGroupModel> listGroups() {
EndpointReferenceType endpointUser = new EndpointReferenceType(); // EndpointReferenceType endpointUser = new EndpointReferenceType();
List<ASLGroupModel> groups = new ArrayList<ASLGroupModel>(); // List<ASLGroupModel> groups = new ArrayList<ASLGroupModel>();
try { // try {
//endpointUser.setAddress(new AttributedURI("http://dl10.di.uoa.gr:8181/usermanagement-ws/LiferaySOAPGroupManager")); // //endpointUser.setAddress(new AttributedURI("http://dl10.di.uoa.gr:8181/usermanagement-ws/LiferaySOAPGroupManager"));
endpointUser.setAddress(new AttributedURI(umServiceLocation + UsersManagementServiceConstants.LiferaySOAPGroupManager)); // endpointUser.setAddress(new AttributedURI(umServiceLocation + UsersManagementServiceConstants.LiferaySOAPGroupManager));
} catch (MalformedURIException e) { // } catch (MalformedURIException e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} // }
LiferaySOAPGroupManagerServiceAddressingLocator loc = new LiferaySOAPGroupManagerServiceAddressingLocator(); // LiferaySOAPGroupManagerServiceAddressingLocator loc = new LiferaySOAPGroupManagerServiceAddressingLocator();
try { // try {
LiferaySOAPGroupManagerPortType groupStub = loc.getLiferaySOAPGroupManagerPortTypePort(endpointUser); // LiferaySOAPGroupManagerPortType groupStub = loc.getLiferaySOAPGroupManagerPortTypePort(endpointUser);
ListGroups listGroups = new ListGroups(); // ListGroups listGroups = new ListGroups();
GroupModel[] groupsArray = groupStub.listGroups(listGroups).get_return(); // GroupModel[] groupsArray = groupStub.listGroups(listGroups).get_return();
for (int i = 0; i < groupsArray.length; i++) { // for (int i = 0; i < groupsArray.length; i++) {
ASLGroupModel gm = new ASLGroupModel(); // ASLGroupModel gm = new ASLGroupModel();
gm.setGroupId(new Long(groupsArray[i].getGroupId())); // gm.setGroupId(new Long(groupsArray[i].getGroupId()));
gm.setGroupName(groupsArray[i].getGroupName()); // gm.setGroupName(groupsArray[i].getGroupName());
gm.setDescription(groupsArray[i].getDescription()); // gm.setDescription(groupsArray[i].getDescription());
groups.add(gm); // groups.add(gm);
} // }
//
} catch (ServiceException e) { // } catch (ServiceException e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} catch (UserManagementSystemException e) { // } catch (UserManagementSystemException e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} catch (RemoteException e) { // } catch (RemoteException e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} // }
//
return groups; // return groups;
} // }
//
//
public boolean isVO(String groupId) { // public boolean isVO(String groupId) {
EndpointReferenceType endpointUser = new EndpointReferenceType(); // EndpointReferenceType endpointUser = new EndpointReferenceType();
List<GroupModel> groups = new ArrayList<GroupModel>(); // List<GroupModel> groups = new ArrayList<GroupModel>();
boolean isVO = false; // boolean isVO = false;
try { // try {
//endpointUser.setAddress(new AttributedURI("http://dl10.di.uoa.gr:8181/usermanagement-ws/LiferaySOAPGroupManager")); // //endpointUser.setAddress(new AttributedURI("http://dl10.di.uoa.gr:8181/usermanagement-ws/LiferaySOAPGroupManager"));
endpointUser.setAddress(new AttributedURI(umServiceLocation + UsersManagementServiceConstants.LiferaySOAPGroupManager)); // endpointUser.setAddress(new AttributedURI(umServiceLocation + UsersManagementServiceConstants.LiferaySOAPGroupManager));
} catch (MalformedURIException e) { // } catch (MalformedURIException e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} // }
LiferaySOAPGroupManagerServiceAddressingLocator loc = new LiferaySOAPGroupManagerServiceAddressingLocator(); // LiferaySOAPGroupManagerServiceAddressingLocator loc = new LiferaySOAPGroupManagerServiceAddressingLocator();
//
try { // try {
LiferaySOAPGroupManagerPortType groupStub = loc.getLiferaySOAPGroupManagerPortTypePort(endpointUser); // LiferaySOAPGroupManagerPortType groupStub = loc.getLiferaySOAPGroupManagerPortTypePort(endpointUser);
//
IsVO isVo = new IsVO(); // IsVO isVo = new IsVO();
isVo.setArg0(groupId); // isVo.setArg0(groupId);
isVO = groupStub.isVO(isVo).get_return(); // isVO = groupStub.isVO(isVo).get_return();
return isVO; // return isVO;
} catch (ServiceException e) { // } catch (ServiceException e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} catch (GroupRetrievalFault e) { // } catch (GroupRetrievalFault e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} catch (UserManagementSystemException e) { // } catch (UserManagementSystemException e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} catch (RemoteException e) { // } catch (RemoteException e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} // }
//
return false; // return false;
} // }
//
//
public boolean isRootVO(String groupId) { // public boolean isRootVO(String groupId) {
EndpointReferenceType endpointUser = new EndpointReferenceType(); // EndpointReferenceType endpointUser = new EndpointReferenceType();
boolean isVO = false; // boolean isVO = false;
try { // try {
//endpointUser.setAddress(new AttributedURI("http://dl10.di.uoa.gr:8181/usermanagement-ws/LiferaySOAPGroupManager")); // //endpointUser.setAddress(new AttributedURI("http://dl10.di.uoa.gr:8181/usermanagement-ws/LiferaySOAPGroupManager"));
endpointUser.setAddress(new AttributedURI(umServiceLocation + UsersManagementServiceConstants.LiferaySOAPGroupManager)); // endpointUser.setAddress(new AttributedURI(umServiceLocation + UsersManagementServiceConstants.LiferaySOAPGroupManager));
} catch (MalformedURIException e) { // } catch (MalformedURIException e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} // }
LiferaySOAPGroupManagerServiceAddressingLocator loc = new LiferaySOAPGroupManagerServiceAddressingLocator(); // LiferaySOAPGroupManagerServiceAddressingLocator loc = new LiferaySOAPGroupManagerServiceAddressingLocator();
//
try { // try {
LiferaySOAPGroupManagerPortType groupStub = loc.getLiferaySOAPGroupManagerPortTypePort(endpointUser); // LiferaySOAPGroupManagerPortType groupStub = loc.getLiferaySOAPGroupManagerPortTypePort(endpointUser);
//
IsRootVO isRootVo = new IsRootVO(); // IsRootVO isRootVo = new IsRootVO();
isRootVo.setArg0(groupId); // isRootVo.setArg0(groupId);
isVO = groupStub.isRootVO(isRootVo).get_return(); // isVO = groupStub.isRootVO(isRootVo).get_return();
return isVO; // return isVO;
} catch (ServiceException e) { // } catch (ServiceException e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} catch (GroupRetrievalFault e) { // } catch (GroupRetrievalFault e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} catch (UserManagementSystemException e) { // } catch (UserManagementSystemException e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} catch (RemoteException e) { // } catch (RemoteException e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} // }
//
return false; // return false;
} // }
//
//
public String getScope(String groupId) { // public String getScope(String groupId) {
EndpointReferenceType endpointUser = new EndpointReferenceType(); // EndpointReferenceType endpointUser = new EndpointReferenceType();
try { // try {
//endpointUser.setAddress(new AttributedURI("http://dl10.di.uoa.gr:8181/usermanagement-ws/LiferaySOAPGroupManager")); // //endpointUser.setAddress(new AttributedURI("http://dl10.di.uoa.gr:8181/usermanagement-ws/LiferaySOAPGroupManager"));
endpointUser.setAddress(new AttributedURI(umServiceLocation + UsersManagementServiceConstants.LiferaySOAPGroupManager)); // endpointUser.setAddress(new AttributedURI(umServiceLocation + UsersManagementServiceConstants.LiferaySOAPGroupManager));
} catch (MalformedURIException e) { // } catch (MalformedURIException e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} // }
LiferaySOAPGroupManagerServiceAddressingLocator loc = new LiferaySOAPGroupManagerServiceAddressingLocator(); // LiferaySOAPGroupManagerServiceAddressingLocator loc = new LiferaySOAPGroupManagerServiceAddressingLocator();
try { // try {
LiferaySOAPGroupManagerPortType groupStub = loc.getLiferaySOAPGroupManagerPortTypePort(endpointUser); // LiferaySOAPGroupManagerPortType groupStub = loc.getLiferaySOAPGroupManagerPortTypePort(endpointUser);
//
GetScope getScope = new GetScope(); // GetScope getScope = new GetScope();
getScope.setArg0(groupId); // getScope.setArg0(groupId);
String scope = groupStub.getScope(getScope).get_return(); // String scope = groupStub.getScope(getScope).get_return();
return scope; // return scope;
} catch (ServiceException e) { // } catch (ServiceException e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} catch (GroupRetrievalFault e) { // } catch (GroupRetrievalFault e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} catch (UserManagementSystemException e) { // } catch (UserManagementSystemException e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} catch (RemoteException e) { // } catch (RemoteException e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} // }
//
return null; // return null;
} // }
//
//
public String getGroupParentId(String groupId) { // public String getGroupParentId(String groupId) {
EndpointReferenceType endpointUser = new EndpointReferenceType(); // EndpointReferenceType endpointUser = new EndpointReferenceType();
try { // try {
//endpointUser.setAddress(new AttributedURI("http://dl10.di.uoa.gr:8181/usermanagement-ws/LiferaySOAPGroupManager")); // //endpointUser.setAddress(new AttributedURI("http://dl10.di.uoa.gr:8181/usermanagement-ws/LiferaySOAPGroupManager"));
endpointUser.setAddress(new AttributedURI(umServiceLocation + UsersManagementServiceConstants.LiferaySOAPGroupManager)); // endpointUser.setAddress(new AttributedURI(umServiceLocation + UsersManagementServiceConstants.LiferaySOAPGroupManager));
} catch (MalformedURIException e) { // } catch (MalformedURIException e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} // }
LiferaySOAPGroupManagerServiceAddressingLocator loc = new LiferaySOAPGroupManagerServiceAddressingLocator(); // LiferaySOAPGroupManagerServiceAddressingLocator loc = new LiferaySOAPGroupManagerServiceAddressingLocator();
try { // try {
LiferaySOAPGroupManagerPortType groupStub = loc.getLiferaySOAPGroupManagerPortTypePort(endpointUser); // LiferaySOAPGroupManagerPortType groupStub = loc.getLiferaySOAPGroupManagerPortTypePort(endpointUser);
//
GetGroupParentId getGroupParentId = new GetGroupParentId(); // GetGroupParentId getGroupParentId = new GetGroupParentId();
getGroupParentId.setArg0(groupId); // getGroupParentId.setArg0(groupId);
long parentId = groupStub.getGroupParentId(getGroupParentId).get_return(); // long parentId = groupStub.getGroupParentId(getGroupParentId).get_return();
return Long.toString(parentId); // return Long.toString(parentId);
} catch (ServiceException e) { // } catch (ServiceException e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} catch (GroupRetrievalFault e) { // } catch (GroupRetrievalFault e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} catch (UserManagementSystemException e) { // } catch (UserManagementSystemException e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} catch (RemoteException e) { // } catch (RemoteException e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
logger.error("Exception:", e); // logger.error("Exception:", e);
} // }
//
return null; // return null;
} // }
//
//
} //}

View File

@ -3,9 +3,6 @@ package org.gcube.application.framework.core.security;
import java.io.File; import java.io.File;
import javax.xml.rpc.ServiceException;
//import javax.xml.rpc.ServiceException;
import org.gcube.application.framework.core.util.Settings; import org.gcube.application.framework.core.util.Settings;
//import org.gcube.vomanagement.vomsapi.ExtendedVOMSAdmin; //import org.gcube.vomanagement.vomsapi.ExtendedVOMSAdmin;