merged
This commit is contained in:
parent
46bde679fe
commit
1988b1a30c
@ -1,8 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
|
||||
<persistence-unit name="hsadmin" transaction-type="RESOURCE_LOCAL">
|
||||
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
|
||||
<non-jta-data-source>java:/comp/env/jdbc/HSAdminDB</non-jta-data-source>
|
||||
<persistence-unit name="hsadmin">
|
||||
<jta-data-source>java:/comp/env/jdbc/HSAdminDB</jta-data-source>
|
||||
<class>de.hsadmin.core.qserv.QueueTask</class>
|
||||
<class>de.hsadmin.mods.cust.Customer</class>
|
||||
<class>de.hsadmin.mods.cust.Contact</class>
|
||||
|
@ -2,9 +2,11 @@ package de.hsadmin.core.model;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import javax.ejb.Stateless;
|
||||
import javax.ejb.LocalBean;
|
||||
import javax.ejb.Stateful;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceContext;
|
||||
import javax.persistence.PersistenceContextType;
|
||||
import javax.persistence.Query;
|
||||
|
||||
import de.hsadmin.core.util.Config;
|
||||
@ -12,14 +14,16 @@ import de.hsadmin.mods.cust.Customer;
|
||||
import de.hsadmin.mods.pac.Pac;
|
||||
import de.hsadmin.mods.user.UnixUser;
|
||||
|
||||
@Stateless
|
||||
@Stateful(name="LoginSession")
|
||||
@LocalBean
|
||||
public class LoginSession implements LoginSessionLocal {
|
||||
|
||||
@PersistenceContext(name="hsadmin")
|
||||
@PersistenceContext(unitName="hsadmin",type=PersistenceContextType.TRANSACTION)
|
||||
private EntityManager entityManager;
|
||||
|
||||
private String loginName;
|
||||
|
||||
@Override
|
||||
public UnixUser getLoginUser() {
|
||||
String loginName = getLoginName();
|
||||
if (loginName != null && loginName.length() == 2) {
|
||||
@ -34,6 +38,7 @@ public class LoginSession implements LoginSessionLocal {
|
||||
return unixUser;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLoginName() {
|
||||
if (loginName != null) {
|
||||
return loginName;
|
||||
@ -41,6 +46,7 @@ public class LoginSession implements LoginSessionLocal {
|
||||
throw new TechnicalException("no login");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean login(String user, String ticket) throws AuthenticationException {
|
||||
String ticketUser = TicketValidator.getInstance().validateTicket(ticket);
|
||||
if (user != null && user.equals(ticketUser)) {
|
||||
|
@ -5,12 +5,14 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.ejb.LocalBean;
|
||||
import javax.ejb.Stateless;
|
||||
|
||||
import de.hsadmin.core.qserv.QueueTask;
|
||||
|
||||
@Stateless
|
||||
public class QueueManager {
|
||||
@LocalBean
|
||||
public class QueueManager implements QueueManagerLocal {
|
||||
|
||||
private final Map<String, QueueTaskStore> taskStores;
|
||||
|
||||
@ -18,6 +20,10 @@ public class QueueManager {
|
||||
taskStores = new HashMap<String, QueueManager.QueueTaskStore>();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see de.hsadmin.core.model.QueueManagerLocal#enqueue(java.lang.String, de.hsadmin.core.qserv.QueueTask)
|
||||
*/
|
||||
@Override
|
||||
public void enqueue(String hiveName, QueueTask task) {
|
||||
QueueTaskStore taskStore = taskStores.get(hiveName);
|
||||
if (taskStore == null) {
|
||||
|
@ -8,6 +8,8 @@ import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
|
||||
import de.hsadmin.core.util.Config;
|
||||
|
||||
|
||||
public class TicketValidator {
|
||||
|
||||
@ -24,12 +26,15 @@ public class TicketValidator {
|
||||
public static TicketValidator getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new TicketValidator();
|
||||
Config config = Config.getInstance();
|
||||
String validateUrl = config.getProperty("proxyValidateUrl");
|
||||
String serviceUrl = config.getProperty("proxyServiceUrl");
|
||||
instance.initialize(validateUrl, serviceUrl);
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
// FIXME wird nicht aufgerufen
|
||||
public void initialize(String validateURL, String serviceURL) {
|
||||
private void initialize(String validateURL, String serviceURL) {
|
||||
proxyServiceURL = serviceURL;
|
||||
proxyValidateURL = validateURL;
|
||||
}
|
||||
|
@ -7,15 +7,19 @@ import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import javax.ejb.EJB;
|
||||
import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
import javax.naming.NamingException;
|
||||
|
||||
import de.hsadmin.core.model.AbstractEntity;
|
||||
import de.hsadmin.core.model.AuthenticationException;
|
||||
import de.hsadmin.core.model.AuthorisationException;
|
||||
import de.hsadmin.core.model.HSAdminException;
|
||||
import de.hsadmin.core.model.LoginSession;
|
||||
import de.hsadmin.core.model.LoginSessionLocal;
|
||||
import de.hsadmin.mods.email.EMailAlias;
|
||||
import de.hsadmin.mods.email.EMailAliasModuleImpl;
|
||||
import de.hsadmin.mods.user.UnixUser;
|
||||
@ -23,11 +27,24 @@ import de.hsadmin.mods.user.UnixUser;
|
||||
public class EMailAliasRemote {
|
||||
|
||||
@EJB
|
||||
private LoginSession session;
|
||||
private LoginSessionLocal session;
|
||||
|
||||
@EJB
|
||||
private EMailAliasModuleImpl module;
|
||||
|
||||
public EMailAliasRemote() {
|
||||
Properties props = new Properties();
|
||||
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.core.LocalInitialContextFactory");
|
||||
Context ctx = null;
|
||||
try {
|
||||
ctx = new InitialContext(props);
|
||||
session = (LoginSessionLocal) ctx.lookup("LoginSessionLocal");
|
||||
module = (EMailAliasModuleImpl) ctx.lookup("EMailAliasModuleLocal");
|
||||
} catch (NamingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> search(String runAsUser, String ticket,
|
||||
Map<String, String> whereParams) throws HSAdminException {
|
||||
String user = runAsUser;
|
||||
|
Loading…
Reference in New Issue
Block a user