You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(217) |
Nov
(180) |
Dec
(71) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(58) |
Feb
(370) |
Mar
(105) |
Apr
(165) |
May
(93) |
Jun
(37) |
Jul
|
Aug
(21) |
Sep
(131) |
Oct
(40) |
Nov
(113) |
Dec
(401) |
2007 |
Jan
(180) |
Feb
(4) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(3) |
2008 |
Jan
(163) |
Feb
(78) |
Mar
|
Apr
(4) |
May
(28) |
Jun
(2) |
Jul
|
Aug
|
Sep
(96) |
Oct
(189) |
Nov
(413) |
Dec
(121) |
2009 |
Jan
(34) |
Feb
(18) |
Mar
(24) |
Apr
(16) |
May
(3) |
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(13) |
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
(3) |
Oct
(16) |
Nov
|
Dec
|
2012 |
Jan
|
Feb
|
Mar
|
Apr
(5) |
May
(35) |
Jun
|
Jul
(17) |
Aug
(7) |
Sep
|
Oct
(9) |
Nov
|
Dec
|
From: Ricardo T. <rj...@us...> - 2005-10-21 17:11:32
|
Update of /cvsroot/itracker/itracker/src/cowsultants/itracker/ejb/authentication In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5726/cowsultants/itracker/ejb/authentication Added Files: Tag: itrackerhibernate TestAuthenticator.java Log Message: no message --- NEW FILE: TestAuthenticator.java --- package cowsultants.itracker.ejb.authentication; import cowsultants.itracker.ejb.client.exceptions.AuthenticatorException; import cowsultants.itracker.ejb.client.interfaces.UserHandler; import cowsultants.itracker.ejb.client.models.UserModel; /** * An authenticator that always returns the admin user. * Mainly for testing * * * @author Ricardo Trindade (ric...@em...) */ public class TestAuthenticator extends DefaultAuthenticator { /** * @see cowsultants.itracker.ejb.authentication.AbstractPluggableAuthenticator#checkLogin(java.lang.String, * java.lang.Object, int, int) */ public UserModel checkLogin(String login, Object authentication, int authType, int reqSource) throws AuthenticatorException { UserHandler userHandler = getUserHandler(); return (userHandler.getUserByLogin("admin")); } /* * (non-Javadoc) * * @see cowsultants.itracker.ejb.authentication.AbstractPluggableAuthenticator#allowProfileUpdates(cowsultants.itracker.ejb.client.models.UserModel, * java.lang.Object, int, int) */ public boolean allowProfileUpdates(UserModel user, Object authentication, int authType, int reqSource) throws AuthenticatorException { return true; } /* * (non-Javadoc) * * @see cowsultants.itracker.ejb.authentication.AbstractPluggableAuthenticator#allowPasswordUpdates(cowsultants.itracker.ejb.client.models.UserModel, * java.lang.Object, int, int) */ public boolean allowPasswordUpdates(UserModel user, Object authentication, int authType, int reqSource) throws AuthenticatorException { return false; } } |
From: Ricardo T. <rj...@us...> - 2005-10-21 17:11:14
|
Update of /cvsroot/itracker/itracker/src/cowsultants/itracker/web/scheduler/tasks In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5569/cowsultants/itracker/web/scheduler/tasks Added Files: Tag: itrackerhibernate MailNotification.java NotificationException.java Log Message: create issues from mailbox --- NEW FILE: MailNotification.java --- package cowsultants.itracker.web.scheduler.tasks; import java.sql.Connection; import java.sql.ResultSet; import java.sql.Statement; import java.util.Properties; import javax.mail.Address; import javax.mail.FetchProfile; import javax.mail.Flags; import javax.mail.Folder; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.Session; import javax.mail.Store; import javax.mail.internet.InternetAddress; import javax.mail.search.FlagTerm; import javax.naming.Context; import javax.naming.InitialContext; import javax.rmi.PortableRemoteObject; import javax.sql.DataSource; import cowsultants.itracker.ejb.client.interfaces.IssueHandler; import cowsultants.itracker.ejb.client.interfaces.IssueHandlerHome; import cowsultants.itracker.ejb.client.interfaces.ProjectHandler; import cowsultants.itracker.ejb.client.interfaces.ProjectHandlerHome; import cowsultants.itracker.ejb.client.interfaces.UserHandler; import cowsultants.itracker.ejb.client.interfaces.UserHandlerHome; import cowsultants.itracker.ejb.client.models.IssueHistoryModel; import cowsultants.itracker.ejb.client.models.IssueModel; import cowsultants.itracker.ejb.client.util.IssueUtilities; import cowsultants.itracker.ejb.client.util.Logger; import cowsultants.itracker.web.scheduler.SchedulableTask; /** * @author rui (rui...@em...) * */ public class MailNotification implements SchedulableTask { private String projectId; private String mailHost; private String user; private String password; private String folderName; private String protocol; public MailNotification() { } /** * */ private String getProjectId() { return projectId; } private void setProjectId(String id) { projectId= id; } /* * (non-Javadoc) * * @see cowsultants.itracker.web.scheduler.SchedulableTask#performTask(java.lang.String[]) */ public void performTask(String[] args) { mailHost = args[0]; user = args[1]; password = args[2]; folderName = args[3]; setProjectId(args[4]); protocol = args[5]; try { process(); } catch (MessagingException e) { Logger.logError(e.getMessage(), e); } catch (NotificationException e) { Logger.logError(e.getMessage(), e); } } /** * process() checks for new messages and calls processMsg() for every new * message * @throws MessagingException * @throws NotificationException */ public void process() throws MessagingException, NotificationException { // Get a Session object // Session session = Session.getDefaultInstance(new Properties(), null); // Connect to host // Store store = session.getStore(protocol); store.connect(mailHost, -1, user, password); // Open the default folder // Folder src_folder = store.getFolder(folderName); if (src_folder == null) throw new NotificationException("Unable to get folder: " + src_folder); // Get message count // src_folder.open(Folder.READ_WRITE); int totalMessages = src_folder.getMessageCount(); // Get attributes & flags for all messages // Message[] messages = src_folder.getMessages(); FetchProfile fp = new FetchProfile(); fp.add(FetchProfile.Item.ENVELOPE); fp.add(FetchProfile.Item.FLAGS); fp.add("From"); src_folder.fetch(messages, fp); // Process each message // FlagTerm search = new FlagTerm(new Flags(Flags.Flag.SEEN), false); for (int i = 0; i < messages.length; i++) { Message message = messages[i]; if (search.match(message)) { try { process_msg(message); message.setFlag(Flags.Flag.SEEN, true); Logger.logInfo("Processed Message: " + message.getSubject() + " From: " + message.getFrom()[0]); } catch (Exception e) { Logger.logError("Couldn't process Message: " + message.getSubject() + " From: " + message.getFrom()[0], e); try { message.setFlag(Flags.Flag.SEEN, false); } catch (Exception exception) { Logger.logError(exception.getMessage(), exception); } } } else { Logger.logInfo("Didn't process Message: " + message.getSubject() + " From: " + message.getFrom()[0] + ". Message already read."); } } src_folder.close(true); store.close(); } private void process_msg(Message msg) throws Exception { Address from = msg.getFrom()[0]; String subject = msg.getSubject(); String content = msg.getContent().toString(); String address = new InternetAddress(from.toString()).getAddress(); insert_issue(address, subject, content, getProjectId()); } private void insert_issue(String address, String subject, String content, String projectId) throws Exception { InitialContext ic = new InitialContext(); Object ihRef = ic.lookup("java:comp/env/" + IssueHandler.JNDI_NAME); IssueHandlerHome ihHome = (IssueHandlerHome) PortableRemoteObject.narrow(ihRef, IssueHandlerHome.class); IssueHandler ih = ihHome.create(); Object phRef = ic.lookup("java:comp/env/" + ProjectHandler.JNDI_NAME); ProjectHandlerHome phHome = (ProjectHandlerHome) PortableRemoteObject.narrow(phRef, ProjectHandlerHome.class); ProjectHandler ph = phHome.create(); Object uhRef = ic.lookup("java:comp/env/" + UserHandler.JNDI_NAME); UserHandlerHome uhHome = (UserHandlerHome) PortableRemoteObject.narrow(uhRef, UserHandlerHome.class); UserHandler uh = uhHome.create(); IssueModel issue = new IssueModel(); issue.setDescription(subject); issue.setSeverity(3); // prioridade média issue.setStatus(IssueUtilities.STATUS_NEW); // Lookup UserID Integer userid = null; Context context = new InitialContext(); Object ref = context.lookup("java:/ITrackerDS"); DataSource ds = (DataSource) ref; Connection dbConnection = ds.getConnection(); Statement statement = dbConnection.createStatement(); statement.execute("SELECT id FROM userbean WHERE email='" + address + "'"); ResultSet rs = statement.getResultSet(); try { rs.next(); userid = new Integer(rs.getString("id")); } catch (Exception e) { Logger.logError("Email " + address + " not valid"); throw e; } finally { dbConnection.close(); } issue = ih.createIssue(issue, new Integer(projectId), userid, userid); IssueHistoryModel issueHistory = new IssueHistoryModel(content, IssueUtilities.HISTORY_STATUS_AVAILABLE, issue .getId(), new Integer(1)); ih.addIssueHistory(issueHistory); } } --- NEW FILE: NotificationException.java --- package cowsultants.itracker.web.scheduler.tasks; /** * @author ricardo * */ public class NotificationException extends Exception { public NotificationException() { } public NotificationException(String msg) { super(msg); } } |
From: Ricardo T. <rj...@us...> - 2005-10-21 11:34:12
|
Update of /cvsroot/itracker/itracker/src/cowsultants/itracker/ejb/authentication/adsson In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11501 Added Files: Tag: itrackerhibernate ADIntegration.java GetUserModelFromADPrivilegedAction.java SimpleCallbackHandler.java WindowsSSONAuthenticator.java WindowsSSONAuthenticatorADInfo.java Log Message: single sign on code for Windows / Active Directory --- NEW FILE: ADIntegration.java --- /** * Originally contributed by eMation (www.emation.pt) */ package cowsultants.itracker.ejb.authentication.adsson; import java.security.AccessControlException; import java.util.Properties; import java.io.InputStream; import java.io.IOException; import javax.security.auth.Subject; import javax.security.auth.login.LoginContext; import javax.security.auth.login.LoginException; import cowsultants.itracker.ejb.client.util.Logger; /** * Performs a kerberos authenticated search in AD * * @author ricardo */ public class ADIntegration { private LoginContext lc = null; private Properties adAuth; private static final String AD_AUTH_PROPERTIES_FILE = "adauth.properties"; private static final String PASSWORD = "password"; private static final String USERNAME = "username"; private static final String BASE_BRANCH = "basebranch"; private static final String PROVIDER_URL = "url"; public ADIntegration() throws IOException { adAuth = new Properties(); InputStream is = getClass().getResourceAsStream( "/" + AD_AUTH_PROPERTIES_FILE); if( is == null) { String message = "Can't find " + AD_AUTH_PROPERTIES_FILE + " to get A.D. auth properties. This file should be in the root of your classpath or EAR file"; Logger.logError( message ); throw new IOException( message ); } adAuth.load( is ); } public void login() throws LoginException { try { // 1. Log in (to Kerberos) // The login context should be configured in login-config.xml lc = new LoginContext("Helpdesk", new SimpleCallbackHandler( getUsername(), getPassword() ) ); // Attempt authentication // You might want to do this in a "for" loop to give // user more than one chance to enter correct username/password lc.login(); } catch (IOException e) { throw new LoginException( e.getMessage() ); } } public Object getUserInfo(String login) throws AccessControlException { // 2. Perform JNDI work as logged in subject Object userInfo = Subject.doAs(lc.getSubject(), new GetUserModelFromADPrivilegedAction( login, getBaseBranch(), getProviderUrl() )); if( userInfo == null ) { Logger.logError("Can't get info on " + login + " from A.D."); throw new AccessControlException("Can't get info on " + login + " from A.D."); } return( userInfo ); } /** * @return */ private String getProviderUrl() { return( adAuth.getProperty( PROVIDER_URL ) ); } /** * @return */ private String getPassword() throws IOException { return( adAuth.getProperty( PASSWORD ) ); } /** * @return */ private String getUsername() throws IOException { return( adAuth.getProperty( USERNAME ) ); } /** * @return */ private String getBaseBranch() { return( adAuth.getProperty( BASE_BRANCH ) ); } } --- NEW FILE: WindowsSSONAuthenticator.java --- /** * Originally contributed by eMation (www.emation.pt) */ package cowsultants.itracker.ejb.authentication.adsson; import java.rmi.RemoteException; import java.util.Date; import javax.servlet.http.HttpServletRequest; import cowsultants.itracker.ejb.authentication.DefaultAuthenticator; import cowsultants.itracker.ejb.client.exceptions.AuthenticatorException; import cowsultants.itracker.ejb.client.exceptions.UserException; import cowsultants.itracker.ejb.client.interfaces.UserHandler; import cowsultants.itracker.ejb.client.models.UserModel; import cowsultants.itracker.ejb.client.models.UserPreferencesModel; import cowsultants.itracker.ejb.client.util.Logger; import cowsultants.itracker.ejb.client.util.UserUtilities; /** * Single Sign On class with Windows * * Gets an authentication from jcifs web filter, gets user information from * active directory, creates or updates the user with that information if needed * * @author Ricardo Trindade (ric...@em...) */ public abstract class WindowsSSONAuthenticator extends DefaultAuthenticator { private static String TEMPLATE_USER = "TemplateUser"; /** * @see cowsultants.itracker.ejb.authentication.AbstractPluggableAuthenticator#checkLogin(java.lang.String, * java.lang.Object, int, int) */ public UserModel checkLogin(String login, Object authentication, int authType, int reqSource) throws AuthenticatorException { UserModel userModel; try { // this authenticator only handles authType=AUTH_TYPE_REQUEST // (HttpServletRequest) if (authType != AUTH_TYPE_REQUEST) { Logger.logError("Only http request authentication supported by this single sign on class. Received " + authType); throw new AuthenticatorException( "Only http request authentication supported by this single sign on class", AuthenticatorException.INVALID_AUTHENTICATION_TYPE); } UserHandler userHandler = getUserHandler(); // validate we're really using jcifs, and we // have a valid authentication object // TODO // get user from jcifs login = ((HttpServletRequest) authentication).getRemoteUser(); if (login == null) { throw new AuthenticatorException("User obtained from jcifs is null. Check that jcifs is active", AuthenticatorException.CUSTOM_ERROR); } // sometimes jcifs sends the username in the form of DOMAIN\USER if (login.indexOf("\\") > 0) { login = login.substring(login.indexOf("\\") + 1); } userModel = updateOrCreateUser(login, userHandler); return userModel; } catch (RemoteException e) { Logger.logError("pt_PT", e.getMessage()); throw new AuthenticatorException(e.getMessage(), AuthenticatorException.SYSTEM_ERROR); } catch (UserException e) { Logger.logError("pt_PT", e.getMessage()); throw new AuthenticatorException(e.getMessage(), AuthenticatorException.SYSTEM_ERROR); } catch (AuthenticatorException e) { Logger.logError("pt_PT", e.getMessage()); throw new AuthenticatorException(e.getMessage(), AuthenticatorException.SYSTEM_ERROR); } } /** * Checks if the user needs creating or updating, and if so, do it * * @param login * @param userHandler * @return * @throws RemoteException * @throws UserException */ private UserModel updateOrCreateUser(String login, UserHandler userHandler) throws RemoteException, UserException, AuthenticatorException { UserModel userModel; // check if the user already exists in ITracker // if he already exists, and needs updating, update him // if not, create him userModel = userHandler.getUserByLogin(login); if (null == userModel) { userModel = createUser(login, userHandler); } else { // user exists, update if needed // get user info from authentication source if (needsUpdate(userModel, getExternalUserInfo(login))) { // update user here... // userHandler.updateUser(); // get updated version userModel = userHandler.getUserByLogin(login); userModel = updateUser(userModel, getExternalUserInfo(login)); userHandler.updateUser(userModel); } } return userModel; } /** * Updates parts of profile that are obtained from external source * * @param model * @return */ private UserModel updateUser(UserModel oldUserModel, UserModel newUserModel) { oldUserModel.setEmail(newUserModel.getEmail()); oldUserModel.setFirstName(newUserModel.getFirstName()); oldUserModel.setLastName(newUserModel.getLastName()); oldUserModel.setLastModifiedDate(new Date()); oldUserModel.setSuperUser(newUserModel.isSuperUser()); return (oldUserModel); } /** * Create a user in the ITracker database * * @param login * @param userModel * @param userHandler * @return * @throws UserException * @throws RemoteException */ private UserModel createUser(String login, UserHandler userHandler) throws RemoteException, UserException, AuthenticatorException { // doesn't exist, create UserModel userModel = getExternalUserInfo(login); userModel.setRegistrationType(UserUtilities.REGISTRATION_TYPE_ADMIN); userModel.setStatus(UserUtilities.STATUS_ACTIVE); userModel = userHandler.createUser(userModel); // if this user is a super user, there is no need to set default // permissions // if not, set default permissions if (!userModel.isSuperUser()) { setDefaultPermissions(userModel, userHandler); } return userModel; } /** * Set the default user permissions * * Default user permissions are the same as those of a user called * "TemplateUser" * * @param userModel * @param userHandler * @throws RemoteException */ private void setDefaultPermissions(UserModel userModel, UserHandler userHandler) throws RemoteException, AuthenticatorException, UserException { UserModel templateUser = userHandler.getUserByLogin(TEMPLATE_USER); if (templateUser == null) { String errorMessage = "TemplateUser not found. Create a user called template user, new permissions are copied from him to new users"; Logger.logError(errorMessage); throw new AuthenticatorException(errorMessage, AuthenticatorException.CUSTOM_ERROR); } // set permissions userHandler.setUserPermissions(userModel.getId(), userHandler.getPermissionsByUserId(templateUser.getId())); // set preferences UserPreferencesModel preferences = userHandler.getUserPreferencesByUserId(templateUser.getId()); preferences.setUserId(userModel.getId()); userHandler.updateUserPreferences(preferences); } /** * Checks if a given internal user needs updating, by comparing him with the * external user data source * * @param localUser * The local UserModel * @param remoteUser * The remote UserModel * @return true if the user needs updating, false otherwise */ private boolean needsUpdate(UserModel localUser, UserModel remoteUser) { if (!(localUser.getEmail().equals(remoteUser.getEmail()))) return true; if (!(localUser.getFirstName().equals(remoteUser.getFirstName()))) return true; if (!(localUser.getLastName().equals(remoteUser.getLastName()))) return true; if (localUser.isSuperUser() != remoteUser.isSuperUser()) return true; return (false); } protected abstract UserModel getExternalUserInfo(String login) throws AuthenticatorException; /* * (non-Javadoc) * * @see cowsultants.itracker.ejb.authentication.AbstractPluggableAuthenticator#allowProfileUpdates(cowsultants.itracker.ejb.client.models.UserModel, * java.lang.Object, int, int) */ public boolean allowProfileUpdates(UserModel user, Object authentication, int authType, int reqSource) throws AuthenticatorException { return true; } /* * (non-Javadoc) * * @see cowsultants.itracker.ejb.authentication.AbstractPluggableAuthenticator#allowPasswordUpdates(cowsultants.itracker.ejb.client.models.UserModel, * java.lang.Object, int, int) */ public boolean allowPasswordUpdates(UserModel user, Object authentication, int authType, int reqSource) throws AuthenticatorException { return false; } } --- NEW FILE: GetUserModelFromADPrivilegedAction.java --- /** * Originally contributed by eMation (www.emation.pt) */ package cowsultants.itracker.ejb.authentication.adsson; import java.util.Enumeration; import java.util.Hashtable; import javax.naming.Context; import javax.naming.NamingEnumeration; import javax.naming.NamingException; import javax.naming.PartialResultException; import javax.naming.directory.Attributes; import javax.naming.directory.DirContext; import javax.naming.directory.InitialDirContext; import javax.naming.directory.SearchControls; import javax.naming.directory.SearchResult; import cowsultants.itracker.ejb.client.models.UserModel; import cowsultants.itracker.ejb.client.util.Logger; /** * * @author ricardo */ public class GetUserModelFromADPrivilegedAction implements java.security.PrivilegedAction { private String login; private static String ITRACKER_SUPER_USERS_GROUP = "ITracker Super Users"; private String providerUrl; private String baseBranch; public GetUserModelFromADPrivilegedAction(String login, String baseBranch, String providerUrl) { this.login = login; this.providerUrl = providerUrl; this.baseBranch = baseBranch; } public Object run() { try { return (getUserInfo(login)); } catch (NamingException e) { Logger.logError(e.getMessage()); return (null); } } private UserModel getUserInfo(String login) throws NamingException { // Set up environment for creating initial context Hashtable env = new Hashtable(11); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); // Must use fully qualified hostname env.put(Context.PROVIDER_URL, providerUrl); // Request the use of the "GSSAPI" SASL mechanism // Authenticate by using already established Kerberos credentials env.put(Context.SECURITY_AUTHENTICATION, "GSSAPI"); /* Create initial context */ DirContext ctx = new InitialDirContext(env); // do something useful with ctx SearchControls sc = new SearchControls(); sc.setCountLimit(1); sc.setSearchScope(SearchControls.SUBTREE_SCOPE); String filter = "(&(objectclass=user)(sAMAccountName=" + login + "))"; NamingEnumeration answer = ctx.search(baseBranch, filter, sc); if (!answer.hasMoreElements()) { Logger.logError("A.D. had no info on " + login); return (null); } SearchResult sr; try { sr = (SearchResult) answer.next(); Logger.logInfo("A.D. had info on " + login); } catch (PartialResultException e) { Logger.logError("A.D. had no info on " + login); return (null); } Attributes attributes = sr.getAttributes(); String mail = ""; String firstName = ""; String lastName = ""; // check that properties are present // active directory sometimes doesn't have "mail" if ((attributes.get("givenName") == null) || (attributes.get("sn") == null)) { Logger.logError("AD didn't return proper attributes. Check that it has at least [mail, givenName , sn]"); return (null); } if (attributes.get("mail") != null) mail = (String) attributes.get("Mail").get(); if (attributes.get("givenName") != null) firstName = (String) attributes.get("givenName").get(); if (attributes.get("sn") != null) lastName = (String) attributes.get("sn").get(); Logger.logInfo("Got at least givenName and sn from A.D. for user " + login); // create user model UserModel userModel = new UserModel(); userModel.setEmail(mail); userModel.setFirstName(firstName); userModel.setLastName(lastName); userModel.setLogin(login); userModel.setPassword("notused="); // if user belongs to "ITracker Super Users" group // make him a super user userModel.setSuperUser(false); Logger.logInfo("About to check if user " + login + " is a super user"); Logger.logDebug("User attributes for user " + login + " " + attributes); if (attributes.get("memberOf") != null) { for (Enumeration groups = attributes.get("memberOf").getAll(); groups.hasMoreElements();) { String group = (String) groups.nextElement(); Logger.logInfo(login + " belongs to NT Group " + group); if (group.indexOf(ITRACKER_SUPER_USERS_GROUP) > 0) { userModel.setSuperUser(true); Logger.logInfo("User " + userModel.getLogin() + " was made an administrator "); } } } else { Logger.logInfo("User attributes didn't contain memberOf...Looks like the A.D. user you specified in the adauth.properties properties file doesn't have enough permissions to check group membership for other users. Give that user enough privileges to read the memberOf attribute from A.D."); } if (userModel.isSuperUser()) { Logger.logInfo(login + " is a super user"); } else { Logger.logInfo(login + " is not a super user"); } ctx.close(); return userModel; } } --- NEW FILE: WindowsSSONAuthenticatorADInfo.java --- /** * Originally contributed by eMation (www.emation.pt) */ package cowsultants.itracker.ejb.authentication.adsson; import java.io.IOException; import javax.security.auth.login.LoginException; import cowsultants.itracker.ejb.client.exceptions.AuthenticatorException; import cowsultants.itracker.ejb.client.models.UserModel; import cowsultants.itracker.ejb.client.util.Logger; /** * Extends the windows single sign on class, gets user information * from active directory * * @author ricardo */ public class WindowsSSONAuthenticatorADInfo extends WindowsSSONAuthenticator { /** * * @see com.emation.itracker.authentication.WindowsSSONAuthenticator#getExternalUserInfo(java.lang.String) */ protected UserModel getExternalUserInfo(String login) throws AuthenticatorException { try { // connect to active directory ADIntegration ad = new ADIntegration(); ad.login(); // get external user info UserModel userModel = (UserModel)ad.getUserInfo( login ); return userModel; } catch (LoginException e) { Logger.logError(" Erro de autenticação no A.D. : " + e.getMessage() + AuthenticatorException.SYSTEM_ERROR ); Logger.logError( "Confirme as suas credenciais de autenticação no A.D. " ); throw new AuthenticatorException( "Erro de autenticação no A.D. : " + e.getMessage(), AuthenticatorException.SYSTEM_ERROR); } catch (IOException e) { Logger.logError( e.getMessage() ); throw new AuthenticatorException( e.getMessage(), AuthenticatorException.SYSTEM_ERROR); } } } --- NEW FILE: SimpleCallbackHandler.java --- /** * Originally contributed by eMation (www.emation.pt) */ package cowsultants.itracker.ejb.authentication.adsson; import javax.security.auth.callback.Callback; import javax.security.auth.callback.CallbackHandler; import javax.security.auth.callback.NameCallback; import javax.security.auth.callback.PasswordCallback; import javax.security.auth.callback.UnsupportedCallbackException; /** * Callback class for Active Directory authentication Gets username and password * from class constructor * * @author ricardo * */ public class SimpleCallbackHandler implements CallbackHandler { private String username; private String password; public SimpleCallbackHandler(String username, String password) { super(); this.username = username; this.password = password; } public void handle(Callback[] callbacks) throws java.io.IOException, UnsupportedCallbackException { for (int i = 0; i < callbacks.length; i++) { if (callbacks[i] instanceof NameCallback) { NameCallback cb = (NameCallback) callbacks[i]; cb.setName(username); } else if (callbacks[i] instanceof PasswordCallback) { PasswordCallback cb = (PasswordCallback) callbacks[i]; cb.setPassword(password.toCharArray()); } else { throw new UnsupportedCallbackException(callbacks[i]); } } } } |
From: Ricardo T. <rj...@us...> - 2005-10-21 11:32:54
|
Update of /cvsroot/itracker/itracker/src/cowsultants/itracker/ejb/authentication/adsson In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11225/adsson Log Message: Directory /cvsroot/itracker/itracker/src/cowsultants/itracker/ejb/authentication/adsson added to the repository --> Using per-directory sticky tag `itrackerhibernate' |
From: Ricardo T. <rj...@us...> - 2005-10-21 11:14:48
|
Update of /cvsroot/itracker/itracker/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6824 Modified Files: Tag: itrackerhibernate itrackerApplication.properties Log Message: user creation now works. admin user creation on startup now works, if so configured. little refactoring on application initialization Index: itrackerApplication.properties =================================================================== RCS file: /cvsroot/itracker/itracker/src/Attic/itrackerApplication.properties,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** itrackerApplication.properties 13 Oct 2005 14:50:19 -0000 1.1.2.2 --- itrackerApplication.properties 21 Oct 2005 11:14:40 -0000 1.1.2.3 *************** *** 31,35 **** # Set to true to create a default admin user if no other users exist in the # database ! #create_super_user=true # Set to true to allow users to recover their passwords --- 31,35 ---- # Set to true to create a default admin user if no other users exist in the # database ! create_super_user=true # Set to true to allow users to recover their passwords |
From: Ricardo T. <rj...@us...> - 2005-10-21 11:14:45
|
Update of /cvsroot/itracker/itracker/src/cowsultants/itracker/ejb/beans/entity In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6726/cowsultants/itracker/ejb/beans/entity Modified Files: Tag: itrackerhibernate UserBean.java Log Message: user creation now works. admin user creation on startup now works, if so configured. little refactoring on application initialization Index: UserBean.java =================================================================== RCS file: /cvsroot/itracker/itracker/src/cowsultants/itracker/ejb/beans/entity/UserBean.java,v retrieving revision 1.9.4.1 retrieving revision 1.9.4.2 diff -C2 -d -r1.9.4.1 -r1.9.4.2 *** UserBean.java 11 Oct 2005 01:21:04 -0000 1.9.4.1 --- UserBean.java 21 Oct 2005 11:14:29 -0000 1.9.4.2 *************** *** 41,46 **** public Collection history; public Collection projects; ! public Collection attachments; ! public Collection getActivities() { return activities; --- 41,46 ---- public Collection history; public Collection projects; ! public Collection attachments; ! public Collection getActivities() { return activities; |
From: Ricardo T. <rj...@us...> - 2005-10-21 11:14:44
|
Update of /cvsroot/itracker/itracker/src/cowsultants/itracker/ejb/client/interfaces In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6726/cowsultants/itracker/ejb/client/interfaces Modified Files: Tag: itrackerhibernate UserHandler.java Log Message: user creation now works. admin user creation on startup now works, if so configured. little refactoring on application initialization Index: UserHandler.java =================================================================== RCS file: /cvsroot/itracker/itracker/src/cowsultants/itracker/ejb/client/interfaces/UserHandler.java,v retrieving revision 1.22.4.2 retrieving revision 1.22.4.3 diff -C2 -d -r1.22.4.2 -r1.22.4.3 *** UserHandler.java 13 Oct 2005 14:26:54 -0000 1.22.4.2 --- UserHandler.java 21 Oct 2005 11:14:29 -0000 1.22.4.3 *************** *** 22,25 **** --- 22,26 ---- import cowsultants.itracker.ejb.beans.session.DataException; + import cowsultants.itracker.ejb.beans.session.NoSuchEntityException; import cowsultants.itracker.ejb.client.exceptions.AuthenticatorException; import cowsultants.itracker.ejb.client.exceptions.PasswordException; *************** *** 35,39 **** public UserModel getUser(Integer userId) throws DataException; ! public UserModel getUserByLogin(String login)throws DataException; public String getUserPasswordByLogin(String login) throws DataException; public UserModel[] getAllUsers() throws DataException; --- 36,40 ---- public UserModel getUser(Integer userId) throws DataException; ! public UserModel getUserByLogin(String login)throws DataException, NoSuchEntityException; public String getUserPasswordByLogin(String login) throws DataException; public UserModel[] getAllUsers() throws DataException; |
From: Ricardo T. <rj...@us...> - 2005-10-21 11:14:44
|
Update of /cvsroot/itracker/itracker/src/cowsultants/itracker/web/servlets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6726/cowsultants/itracker/web/servlets Modified Files: Tag: itrackerhibernate ApplicationInitialization.java Log Message: user creation now works. admin user creation on startup now works, if so configured. little refactoring on application initialization Index: ApplicationInitialization.java =================================================================== RCS file: /cvsroot/itracker/itracker/src/cowsultants/itracker/web/servlets/ApplicationInitialization.java,v retrieving revision 1.31.4.3 retrieving revision 1.31.4.4 diff -C2 -d -r1.31.4.3 -r1.31.4.4 *** ApplicationInitialization.java 18 Oct 2005 20:38:48 -0000 1.31.4.3 --- ApplicationInitialization.java 21 Oct 2005 11:14:28 -0000 1.31.4.4 *************** *** 42,45 **** --- 42,46 ---- import cowsultants.itracker.ejb.beans.session.DataException; + import cowsultants.itracker.ejb.beans.session.NoSuchEntityException; import cowsultants.itracker.ejb.beans.session.ReportHandlerBean; import cowsultants.itracker.ejb.beans.session.SpringFactories; *************** *** 62,66 **** import cowsultants.itracker.ejb.client.util.UserUtilities; ! public class ApplicationInitialization extends GenericController { public ApplicationInitialization(SpringFactories springFactories) { --- 63,67 ---- import cowsultants.itracker.ejb.client.util.UserUtilities; ! public class ApplicationInitialization extends GenericController { public ApplicationInitialization(SpringFactories springFactories) { *************** *** 70,80 **** public void init() { SessionFactory sessionFactory = null; ! ! try { sessionFactory = SpringFactories.getSessionFactory(); Session session = sessionFactory.openSession(); ! TransactionSynchronizationManager.bindResource(sessionFactory, new SessionHolder(session)); ! SystemConfiguration sc = new SystemConfigurationBean(); --- 71,81 ---- public void init() { SessionFactory sessionFactory = null; ! ! try { sessionFactory = SpringFactories.getSessionFactory(); Session session = sessionFactory.openSession(); ! TransactionSynchronizationManager.bindResource(sessionFactory, new SessionHolder(session)); ! SystemConfiguration sc = new SystemConfigurationBean(); *************** *** 83,88 **** Logger.logInfo("Checking and initializing languages in the database."); ! //SystemConfigurationUtilities.initializeAllLanguages(sc, false); ! SystemConfigurationUtilities.initializeAllLanguages(sc, true); // TMP CHANGE BY RJST Logger.logInfo("Checking and initializing default system configuration in the database."); --- 84,90 ---- Logger.logInfo("Checking and initializing languages in the database."); ! SystemConfigurationUtilities.initializeAllLanguages(sc, false); ! // SystemConfigurationUtilities.initializeAllLanguages(sc, true); // ! // TMP CHANGE BY RJST Logger.logInfo("Checking and initializing default system configuration in the database."); *************** *** 98,102 **** sc.resetConfigurationCache(); ! // Pre-initialize all of the PDF fonts available. Do it in a seperate thread to speed up the // rest of the startup. Thread initFontThread = new Thread() { --- 100,105 ---- sc.resetConfigurationCache(); ! // Pre-initialize all of the PDF fonts available. Do it in a ! // seperate thread to speed up the // rest of the startup. Thread initFontThread = new Thread() { *************** *** 108,128 **** initFontThread.start(); ! boolean createAdmin = sc.getBooleanProperty("create_super_user", false); ! if(createAdmin) { ! Logger.logInfo("Create default admin user option set to true. Checking for existing users."); ! UserHandler uh = new UserHandlerBean(); ! ! UserModel[] users = uh.getAllUsers(); ! if(users.length == 0) { ! Logger.logDebug("Attempting to create admin user."); ! try { ! UserModel adminUser = new UserModel("admin", UserUtilities.encryptPassword("admin"), "Super", "User", "", true); ! uh.createUser(adminUser); ! } catch(PasswordException pe) { ! Logger.logInfo("Unable to create admin user. Error: " + pe.getMessage()); ! } ! } ! } ! } catch(UserException ue) { Logger.logWarn("Exception while creating admin user.", ue); } catch (DataException e) { --- 111,119 ---- initFontThread.start(); ! // check for and create admin user, if so configured ! createAdminUser(sc); ! } catch (PasswordException pe) { ! Logger.logInfo("Unable to create admin user. Error: " + pe.getMessage()); ! } catch (UserException ue) { Logger.logWarn("Exception while creating admin user.", ue); } catch (DataException e) { *************** *** 145,153 **** } public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } private void processAttachmentFiles(String attachmentDirectory) { ! if(attachmentDirectory == null || attachmentDirectory.equals("")) { return; } --- 136,167 ---- } + /** + * Check if we should create the admin user, if so, do it. + * + * @param sc + * @throws PasswordException + * @throws UserException + */ + private void createAdminUser(SystemConfiguration sc) throws PasswordException, UserException { + boolean createAdmin = sc.getBooleanProperty("create_super_user", false); + if (createAdmin) { + Logger.logInfo("Create default admin user option set to true. Checking for existing admin user."); + UserHandler uh = new UserHandlerBean(); + try { + uh.getUserByLogin("admin"); + } catch (NoSuchEntityException e) { + Logger.logDebug("Attempting to create admin user."); + UserModel adminUser = new UserModel("admin", UserUtilities.encryptPassword("admin"), "Super", "User", + "", true); + uh.createUser(adminUser); + } + } + } + public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } private void processAttachmentFiles(String attachmentDirectory) { ! if (attachmentDirectory == null || attachmentDirectory.equals("")) { return; } *************** *** 155,159 **** try { File directory = new File(attachmentDirectory.replace('/', File.separatorChar)); ! if(directory == null || ! directory.isDirectory()) { throw new Exception("Invalid attachment directory."); } --- 169,173 ---- try { File directory = new File(attachmentDirectory.replace('/', File.separatorChar)); ! if (directory == null || !directory.isDirectory()) { throw new Exception("Invalid attachment directory."); } *************** *** 165,171 **** IssueHandler ih = ihHome.create(); ! for(int i = 0; i < attachments.length; i++) { try { ! if(attachments[i].length() > Integer.MAX_VALUE) { throw new IOException("File too large to load."); } --- 179,185 ---- IssueHandler ih = ihHome.create(); ! for (int i = 0; i < attachments.length; i++) { try { ! if (attachments[i].length() > Integer.MAX_VALUE) { throw new IOException("File too large to load."); } *************** *** 174,189 **** int bytesRead = fis.read(data); fis.close(); ! if(bytesRead != data.length) { ! throw new IOException("The number of bytes read from the file, did not match the size of the file."); } ! if(ih.setIssueAttachmentData(attachments[i].getName(), data)) { ! //attachments[i].delete(); ! Logger.logDebug("Successfully moved attachment " + attachments[i].getName() + " to the database."); } ! } catch(IOException ioe) { Logger.logError("Unable to save attachment: " + ioe.getMessage()); } } ! } catch(Exception e) { Logger.logError("Unable to check for existing file attachments: " + e.getMessage()); } --- 188,205 ---- int bytesRead = fis.read(data); fis.close(); ! if (bytesRead != data.length) { ! throw new IOException( ! "The number of bytes read from the file, did not match the size of the file."); } ! if (ih.setIssueAttachmentData(attachments[i].getName(), data)) { ! // attachments[i].delete(); ! Logger.logDebug("Successfully moved attachment " + attachments[i].getName() ! + " to the database."); } ! } catch (IOException ioe) { Logger.logError("Unable to save attachment: " + ioe.getMessage()); } } ! } catch (Exception e) { Logger.logError("Unable to check for existing file attachments: " + e.getMessage()); } *************** *** 191,207 **** private void processReports() { ! try { ReportHandler rh = new ReportHandlerBean(); ReportModel[] reports = rh.getAllReports(); String line; ! InputStream is = getClass().getResourceAsStream("/cowsultants/itracker/web/reports/predefined/predefinedReports.properties"); BufferedReader br = new BufferedReader(new InputStreamReader(is)); ! LINE: while((line = br.readLine()) != null) { ! if(line.equals("") || line.startsWith("#")) { continue; } int splitChar = line.indexOf('='); ! if(splitChar < 0) { continue; } --- 207,224 ---- private void processReports() { ! try { ReportHandler rh = new ReportHandlerBean(); ReportModel[] reports = rh.getAllReports(); String line; ! InputStream is = getClass().getResourceAsStream( ! "/cowsultants/itracker/web/reports/predefined/predefinedReports.properties"); BufferedReader br = new BufferedReader(new InputStreamReader(is)); ! LINE: while ((line = br.readLine()) != null) { ! if (line.equals("") || line.startsWith("#")) { continue; } int splitChar = line.indexOf('='); ! if (splitChar < 0) { continue; } *************** *** 210,259 **** String value = line.substring(splitChar + 1); ! if("report".equalsIgnoreCase(key)) { try { String repLine; ReportModel report = new ReportModel(); ! InputStream reportStream = getClass().getResourceAsStream("/cowsultants/itracker/web/reports/predefined/" + value); ! if(reportStream == null) { throw new IOException("Could not access predefined report '" + value + "'"); } BufferedReader rbr = new BufferedReader(new InputStreamReader(reportStream)); ! while((repLine = rbr.readLine()) != null) { ! if(repLine.equals("") || line.startsWith("#")) { continue; } int repSplitChar = repLine.indexOf('='); ! if(repSplitChar < 0) { continue; } String repKey = repLine.substring(0, repSplitChar); ! String repValue = (repLine.length() > repSplitChar ? repLine.substring(repSplitChar + 1) : ""); ! if(repValue == null || "".equals(repValue)) { continue; ! } else if("id".equals(repKey)) { report.setId(new Integer(repValue)); ! } else if("name".equals(repKey)) { report.setName(repValue); ! } else if("namekey".equals(repKey)) { report.setNameKey(repValue); ! } else if("dataType".equals(repKey)) { report.setDataType(Integer.parseInt(repValue)); ! } else if("reportType".equals(repKey)) { report.setReportType(Integer.parseInt(repValue)); ! } else if("className".equals(repKey)) { report.setClassName(repValue); ! } else if("description".equals(repKey)) { report.setDescription((String) Base64.decodeToObject(repValue)); ! } else if("definition".equals(repKey)) { report.setFileData(Base64.decode(repValue)); } } ! if("".equals(report.getName()) || report.getDataType() == 0 || (report.getClassName() == null && report.getFileData().length == 0)) { throw new Exception("Invalid report definition found."); } Logger.logDebug("Loading " + report.toString()); ! for(int i = 0; i < reports.length; i++) { ! if(reports[i].equals(report)) { Logger.logDebug("Found existing report, updating."); report.setId(reports[i].getId()); --- 227,279 ---- String value = line.substring(splitChar + 1); ! if ("report".equalsIgnoreCase(key)) { try { String repLine; ReportModel report = new ReportModel(); ! InputStream reportStream = getClass().getResourceAsStream( ! "/cowsultants/itracker/web/reports/predefined/" + value); ! if (reportStream == null) { throw new IOException("Could not access predefined report '" + value + "'"); } BufferedReader rbr = new BufferedReader(new InputStreamReader(reportStream)); ! while ((repLine = rbr.readLine()) != null) { ! if (repLine.equals("") || line.startsWith("#")) { continue; } int repSplitChar = repLine.indexOf('='); ! if (repSplitChar < 0) { continue; } String repKey = repLine.substring(0, repSplitChar); ! String repValue = (repLine.length() > repSplitChar ? repLine.substring(repSplitChar + 1) ! : ""); ! if (repValue == null || "".equals(repValue)) { continue; ! } else if ("id".equals(repKey)) { report.setId(new Integer(repValue)); ! } else if ("name".equals(repKey)) { report.setName(repValue); ! } else if ("namekey".equals(repKey)) { report.setNameKey(repValue); ! } else if ("dataType".equals(repKey)) { report.setDataType(Integer.parseInt(repValue)); ! } else if ("reportType".equals(repKey)) { report.setReportType(Integer.parseInt(repValue)); ! } else if ("className".equals(repKey)) { report.setClassName(repValue); ! } else if ("description".equals(repKey)) { report.setDescription((String) Base64.decodeToObject(repValue)); ! } else if ("definition".equals(repKey)) { report.setFileData(Base64.decode(repValue)); } } ! if ("".equals(report.getName()) || report.getDataType() == 0 ! || (report.getClassName() == null && report.getFileData().length == 0)) { throw new Exception("Invalid report definition found."); } Logger.logDebug("Loading " + report.toString()); ! for (int i = 0; i < reports.length; i++) { ! if (reports[i].equals(report)) { Logger.logDebug("Found existing report, updating."); report.setId(reports[i].getId()); *************** *** 264,268 **** Logger.logDebug("No existing report found, creating new report."); rh.createReport(report); ! } catch(Exception e) { Logger.logError("Unable to process report '" + value + "': " + e.getMessage()); Logger.logDebug("Stacktrace:", e); --- 284,288 ---- Logger.logDebug("No existing report found, creating new report."); rh.createReport(report); ! } catch (Exception e) { Logger.logError("Unable to process report '" + value + "': " + e.getMessage()); Logger.logDebug("Stacktrace:", e); *************** *** 270,277 **** } } ! } catch(Exception e) { Logger.logError("Unable to process predefined reports.", e); } ! } } - \ No newline at end of file --- 290,296 ---- } } ! } catch (Exception e) { Logger.logError("Unable to process predefined reports.", e); } ! } } |
From: Ricardo T. <rj...@us...> - 2005-10-21 11:14:44
|
Update of /cvsroot/itracker/itracker/src/cowsultants/itracker/ejb/beans/session In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6726/cowsultants/itracker/ejb/beans/session Modified Files: Tag: itrackerhibernate UserFactory.java UserFactoryImpl.java UserHandlerBean.java Log Message: user creation now works. admin user creation on startup now works, if so configured. little refactoring on application initialization Index: UserFactory.java =================================================================== RCS file: /cvsroot/itracker/itracker/src/cowsultants/itracker/ejb/beans/session/Attic/UserFactory.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** UserFactory.java 11 Oct 2005 01:36:08 -0000 1.1.2.1 --- UserFactory.java 21 Oct 2005 11:14:29 -0000 1.1.2.2 *************** *** 7,12 **** import cowsultants.itracker.ejb.client.models.UserModel; ! public interface UserFactory { ! public UserBean findByPrimaryKey(Integer userId) throws DataException; --- 7,12 ---- import cowsultants.itracker.ejb.client.models.UserModel; ! public interface UserFactory extends BaseFactory { ! public UserBean findByPrimaryKey(Integer userId) throws DataException; Index: UserFactoryImpl.java =================================================================== RCS file: /cvsroot/itracker/itracker/src/cowsultants/itracker/ejb/beans/session/Attic/UserFactoryImpl.java,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** UserFactoryImpl.java 13 Oct 2005 14:42:18 -0000 1.1.2.2 --- UserFactoryImpl.java 21 Oct 2005 11:14:29 -0000 1.1.2.3 *************** *** 7,17 **** import net.sf.hibernate.HibernateException; import net.sf.hibernate.expression.Expression; - - import org.springframework.orm.hibernate.support.HibernateDaoSupport; - import cowsultants.itracker.ejb.beans.entity.UserBean; import cowsultants.itracker.ejb.client.models.UserModel; ! public class UserFactoryImpl extends HibernateDaoSupport implements UserFactory { public UserBean findByPrimaryKey(Integer userId) throws DataException { --- 7,14 ---- import net.sf.hibernate.HibernateException; import net.sf.hibernate.expression.Expression; import cowsultants.itracker.ejb.beans.entity.UserBean; import cowsultants.itracker.ejb.client.models.UserModel; ! public class UserFactoryImpl extends BaseHibernateFactoryImpl implements UserFactory { public UserBean findByPrimaryKey(Integer userId) throws DataException { Index: UserHandlerBean.java =================================================================== RCS file: /cvsroot/itracker/itracker/src/cowsultants/itracker/ejb/beans/session/UserHandlerBean.java,v retrieving revision 1.44.4.1 retrieving revision 1.44.4.2 diff -C2 -d -r1.44.4.1 -r1.44.4.2 *** UserHandlerBean.java 11 Oct 2005 01:21:04 -0000 1.44.4.1 --- UserHandlerBean.java 21 Oct 2005 11:14:29 -0000 1.44.4.2 *************** *** 19,23 **** --- 19,25 ---- package cowsultants.itracker.ejb.beans.session; + import java.sql.Timestamp; import java.util.Collection; + import java.util.Date; import java.util.HashMap; import java.util.HashSet; *************** *** 101,106 **** permissionHome = SpringFactories.getPermissionFactory(); phHome = null;// (ProjectHandlerHome) ! // PortableRemoteObject.narrow(phRef, ! // ProjectHandlerHome.class); SystemConfiguration sc = new SystemConfigurationBean(); --- 103,108 ---- permissionHome = SpringFactories.getPermissionFactory(); phHome = null;// (ProjectHandlerHome) ! // PortableRemoteObject.narrow(phRef, ! // ProjectHandlerHome.class); SystemConfiguration sc = new SystemConfigurationBean(); *************** *** 122,127 **** } ! public UserModel getUserByLogin(String login) throws DataException { UserBean user = uHome.findByLogin(login); return user.getModel(); } --- 124,131 ---- } ! public UserModel getUserByLogin(String login) throws DataException, NoSuchEntityException { UserBean user = uHome.findByLogin(login); + if (user == null) + throw new NoSuchEntityException("User " + login + " not found."); return user.getModel(); } *************** *** 183,232 **** public UserModel createUser(UserModel model) throws UserException { ! /* ! * try { if(model == null || model.getLogin() == null || ! * model.getLogin().equals("")) { throw new CreateException("User data ! * was null, or login was empty."); } ! * ! * try { UserBean userTest = uHome.findByLogin(model.getLogin()); throw ! * new CreateException("User already exists with login: " + ! * model.getLogin()); } catch(ObjectNotFoundException onfe) { } ! * catch(FinderException fe) { //throw new CreateException("Testing for ! * existing login failed: " + fe.getMessage()); } ! * ! * try { PluggableAuthenticator authenticator = (PluggableAuthenticator) ! * authenticatorClass.newInstance(); if(authenticator != null) { HashMap ! * values = new HashMap(); values.put("userHandler", ! * context.getEJBLocalObject()); values.put("systemConfiguration", ! * scHome.create()); authenticator.initialize(values); ! * authenticator.createProfile(model, null, ! * AuthenticationConstants.AUTH_TYPE_UNKNOWN, ! * AuthenticationConstants.REQ_SOURCE_UNKNOWN); } else { ! * Logger.logError("Unable to create new authenticator."); throw new ! * AuthenticatorException(AuthenticatorException.SYSTEM_ERROR); } } ! * catch(IllegalAccessException iae) { Logger.logError("Authenticator ! * class " + authenticatorClassName + " can not be instantiated."); ! * throw new ! * AuthenticatorException(AuthenticatorException.SYSTEM_ERROR); } ! * catch(InstantiationException ie) { Logger.logError("Authenticator ! * class " + authenticatorClassName + " can not be instantiated."); ! * throw new ! * AuthenticatorException(AuthenticatorException.SYSTEM_ERROR); } ! * catch(ClassCastException cce) { Logger.logError("Authenticator class " + ! * authenticatorClassName + " does not extend the PluggableAuthenticator ! * class."); throw new ! * AuthenticatorException(AuthenticatorException.SYSTEM_ERROR); } ! * catch(CreateException ce) { Logger.logError("Error creating new ! * SystemConfiguration. " + ce.getMessage()); throw new ! * AuthenticatorException(AuthenticatorException.SYSTEM_ERROR); } ! * ! * UserBean user = new UserBean(); user.setModel(model); ! * user.setStatus(UserUtilities.STATUS_ACTIVE); ! * user.setRegistrationType(model.getRegistrationType()); return ! * user.getModel(); } catch(CreateException ce) { Logger.logDebug("Could ! * not create user.", ce); throw new UserException(ce.getMessage()); } ! * catch(AuthenticatorException ae) { Logger.logDebug("Could not create ! * user.", ae); throw new UserException(ae.getMessage()); } ! */ ! return null; } --- 187,239 ---- public UserModel createUser(UserModel model) throws UserException { ! try { ! if (model == null || model.getLogin() == null || model.getLogin().equals("")) { ! throw new UserException("User data was null, or login was empty."); ! } ! ! try { ! this.getUserByLogin(model.getLogin()); ! throw new UserException("User already exists with login: " + model.getLogin()); ! } catch (NoSuchEntityException e) { ! // doesn't exist, we'll create him ! } ! ! try { ! PluggableAuthenticator authenticator = (PluggableAuthenticator) authenticatorClass.newInstance(); ! if (authenticator != null) { ! HashMap values = new HashMap(); ! values.put("userHandler", this); ! values.put("systemConfiguration", new SystemConfigurationBean()); ! authenticator.initialize(values); ! authenticator.createProfile(model, null, AuthenticationConstants.AUTH_TYPE_UNKNOWN, ! AuthenticationConstants.REQ_SOURCE_UNKNOWN); ! } else { ! Logger.logError("Unable to create new authenticator."); ! throw new AuthenticatorException(AuthenticatorException.SYSTEM_ERROR); ! } ! } catch (IllegalAccessException iae) { ! Logger.logError("Authenticator class " + authenticatorClassName + " can not be instantiated."); ! throw new AuthenticatorException(AuthenticatorException.SYSTEM_ERROR); ! } catch (InstantiationException ie) { ! Logger.logError("Authenticator class " + authenticatorClassName + " can not be instantiated."); ! throw new AuthenticatorException(AuthenticatorException.SYSTEM_ERROR); ! } catch (ClassCastException cce) { ! Logger.logError("Authenticator class " + authenticatorClassName ! + " does not extend the PluggableAuthenticator class."); ! throw new AuthenticatorException(AuthenticatorException.SYSTEM_ERROR); ! } ! ! UserBean user = new UserBean(); ! user.setModel(model); ! user.setStatus(UserUtilities.STATUS_ACTIVE); ! user.setRegistrationType(model.getRegistrationType()); ! user.setCreateDate( new Timestamp( new Date().getTime() )); ! uHome.saveOrUpdate(user); ! return user.getModel(); ! } catch (AuthenticatorException ae) { ! Logger.logDebug("Could not create user.", ae); ! throw new UserException(ae.getMessage()); ! } ! } *************** *** 316,326 **** } ! //try { ! userPrefs = upHome.findByUserId(model.getUserId()); ! /*} catch (ObjectNotFoundException onfe) { ! if (userPrefs == null || userPrefs.getUser().getId().intValue() != model.getUserId().intValue()) { ! userPrefs = new UserPreferencesBean(); ! } ! }*/ userPrefs.setUser(user); --- 323,334 ---- } ! // try { ! userPrefs = upHome.findByUserId(model.getUserId()); ! /* ! * } catch (ObjectNotFoundException onfe) { if (userPrefs == null || ! * userPrefs.getUser().getId().intValue() != ! * model.getUserId().intValue()) { userPrefs = new ! * UserPreferencesBean(); } } ! */ userPrefs.setUser(user); |
From: Marky G. <mar...@us...> - 2005-10-20 07:46:07
|
Update of /cvsroot/itracker/itracker/sql/mysql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20447/sql/mysql Modified Files: Tag: itrackerhibernate README.txt Log Message: updated. Index: README.txt =================================================================== RCS file: /cvsroot/itracker/itracker/sql/mysql/Attic/README.txt,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** README.txt 20 Oct 2005 07:29:34 -0000 1.1.2.1 --- README.txt 20 Oct 2005 07:45:59 -0000 1.1.2.2 *************** *** 1 **** ! if you have problems running the create_itracker_core.sql Script in MySQL Administrator tool, then try to run the script from the Shell mysql command. This should work. \ No newline at end of file --- 1 ---- ! if you have problems running the create_itracker_core.sql Script in MySQL Query Browser tool, then try to run the script from the Shell mysql command. This should work. \ No newline at end of file |
From: Marky G. <mar...@us...> - 2005-10-20 07:29:45
|
Update of /cvsroot/itracker/itracker/sql/mysql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18556/sql/mysql Added Files: Tag: itrackerhibernate README.txt Log Message: README containing workaround for sql script problem in mysql administrator. --- NEW FILE: README.txt --- if you have problems running the create_itracker_core.sql Script in MySQL Administrator tool, then try to run the script from the Shell mysql command. This should work. |
From: Ricardo T. <rj...@us...> - 2005-10-18 22:43:53
|
Update of /cvsroot/itracker/itracker/src/cowsultants/itracker/ejb/beans/session In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22374/cowsultants/itracker/ejb/beans/session Added Files: Tag: itrackerhibernate BaseFactory.java BaseHibernateFactoryImpl.java NoSuchEntityException.java Log Message: common behaviour for hibernate factories --- NEW FILE: NoSuchEntityException.java --- package cowsultants.itracker.ejb.beans.session; public class NoSuchEntityException extends RuntimeException { public NoSuchEntityException(String msg) { super(msg); } public NoSuchEntityException(Throwable cause) { super(cause); } public NoSuchEntityException(String msg, Throwable cause) { super(msg,cause); } } --- NEW FILE: BaseHibernateFactoryImpl.java --- package cowsultants.itracker.ejb.beans.session; import net.sf.hibernate.HibernateException; import org.springframework.orm.hibernate.support.HibernateDaoSupport; /** * Contains common behaviour to all hibernate factories * * @author rui silva */ public class BaseHibernateFactoryImpl extends HibernateDaoSupport { /** * */ public BaseHibernateFactoryImpl() { super(); } public void save(Object object) throws DataException { try { getSession().save(object); } catch (HibernateException e) { throw new DataException(e); } } /** * */ public void saveOrUpdate(Object object) throws DataException { try { getSession().saveOrUpdate(object); } catch (HibernateException e) { throw new DataException(e); } } } --- NEW FILE: BaseFactory.java --- package cowsultants.itracker.ejb.beans.session; public interface BaseFactory { public void save(Object object)throws DataException; public void saveOrUpdate(Object object) throws DataException; } |
From: Ricardo T. <rj...@us...> - 2005-10-18 21:20:51
|
Update of /cvsroot/itracker/itracker/src/cowsultants/itracker/ejb/client/interfaces In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1667/cowsultants/itracker/ejb/client/interfaces Modified Files: Tag: itrackerhibernate IssueSearch.java Log Message: fixed loading db on startup Index: IssueSearch.java =================================================================== RCS file: /cvsroot/itracker/itracker/src/cowsultants/itracker/ejb/client/interfaces/IssueSearch.java,v retrieving revision 1.6 retrieving revision 1.6.4.1 diff -C2 -d -r1.6 -r1.6.4.1 *** IssueSearch.java 22 Aug 2005 11:41:28 -0000 1.6 --- IssueSearch.java 18 Oct 2005 21:20:40 -0000 1.6.4.1 *************** *** 19,32 **** package cowsultants.itracker.ejb.client.interfaces; ! import java.util.*; ! import javax.ejb.EJBLocalObject; ! ! import cowsultants.itracker.ejb.client.exceptions.*; ! import cowsultants.itracker.ejb.client.models.*; ! public interface IssueSearch extends EJBLocalObject { ! public static final String JNDI_NAME = "ejb/IssueSearch"; public IssueModel[] searchIssues(IssueSearchQueryModel model, UserModel user, HashMap permissions) throws IssueSearchException; - } \ No newline at end of file --- 19,31 ---- package cowsultants.itracker.ejb.client.interfaces; ! import java.util.HashMap; ! import cowsultants.itracker.ejb.client.exceptions.IssueSearchException; ! import cowsultants.itracker.ejb.client.models.IssueModel; ! import cowsultants.itracker.ejb.client.models.IssueSearchQueryModel; ! import cowsultants.itracker.ejb.client.models.UserModel; + public interface IssueSearch { + public IssueModel[] searchIssues(IssueSearchQueryModel model, UserModel user, HashMap permissions) throws IssueSearchException; } \ No newline at end of file |
From: Ricardo T. <rj...@us...> - 2005-10-18 21:20:48
|
Update of /cvsroot/itracker/itracker/src/cowsultants/itracker/ejb/beans/session In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1667/cowsultants/itracker/ejb/beans/session Modified Files: Tag: itrackerhibernate LanguageFactory.java SystemConfigurationBean.java Log Message: fixed loading db on startup Index: SystemConfigurationBean.java =================================================================== RCS file: /cvsroot/itracker/itracker/src/cowsultants/itracker/ejb/beans/session/SystemConfigurationBean.java,v retrieving revision 1.31.4.1 retrieving revision 1.31.4.2 diff -C2 -d -r1.31.4.1 -r1.31.4.2 *** SystemConfigurationBean.java 11 Oct 2005 01:21:04 -0000 1.31.4.1 --- SystemConfigurationBean.java 18 Oct 2005 21:20:40 -0000 1.31.4.2 *************** *** 1,824 **** ! /* ! * This software was designed and created by Jason Carroll. ! * Copyright (c) 2002, 2003, 2004 Jason Carroll. ! * The author can be reached at jca...@co... ! * ITracker website: http://www.cowsultants.com ! * ITracker forums: http://www.cowsultants.com/phpBB/index.php ! * ! * This program is free software; you can redistribute it and/or modify ! * it only under the terms of the GNU General Public License as published by ! * the Free Software Foundation; either version 2 of the License, or ! * (at your option) any later version. ! * ! * This program is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. ! */ ! ! package cowsultants.itracker.ejb.beans.session; ! ! import java.util.Arrays; ! import java.util.Collection; ! import java.util.Enumeration; ! import java.util.HashMap; ! import java.util.Iterator; ! import java.util.Locale; ! import java.util.Properties; ! import java.util.Vector; ! ! import javax.naming.InitialContext; ! ! import cowsultants.itracker.ejb.beans.entity.ConfigurationBean; ! import cowsultants.itracker.ejb.beans.entity.CustomFieldBean; ! import cowsultants.itracker.ejb.beans.entity.CustomFieldValueBean; ! import cowsultants.itracker.ejb.beans.entity.LanguageBean; ! import cowsultants.itracker.ejb.beans.entity.WorkflowScriptBean; ! import cowsultants.itracker.ejb.client.exceptions.SystemConfigurationException; ! import cowsultants.itracker.ejb.client.interfaces.SystemConfiguration; ! import cowsultants.itracker.ejb.client.models.ConfigurationModel; ! import cowsultants.itracker.ejb.client.models.CustomFieldModel; ! import cowsultants.itracker.ejb.client.models.CustomFieldValueModel; ! import cowsultants.itracker.ejb.client.models.LanguageModel; ! import cowsultants.itracker.ejb.client.models.NameValuePairModel; ! import cowsultants.itracker.ejb.client.models.SystemConfigurationModel; ! import cowsultants.itracker.ejb.client.models.WorkflowScriptModel; ! import cowsultants.itracker.ejb.client.resources.ITrackerResources; ! import cowsultants.itracker.ejb.client.util.IssueUtilities; ! import cowsultants.itracker.ejb.client.util.Logger; ! import cowsultants.itracker.ejb.client.util.SystemConfigurationUtilities; ! import cowsultants.itracker.ejb.util.PropertiesFileHandler; ! ! /** ! * Implimetation of the SystemConfiguration Interface. ! * @see SystemConfiguration ! */ ! public class SystemConfigurationBean implements SystemConfiguration { ! private static Properties props = null; ! ! InitialContext ic = null; ! ! ConfigurationFactory cHome = null; ! CustomFieldFactory cfHome = null; ! CustomFieldValueFactory cfvHome = null; ! LanguageFactory lHome = null; ! WorkflowScriptFactory wsHome = null; ! ! public SystemConfigurationBean() { ! if(props == null) { ! props = new Properties(); ! ! // try { ! // ic = new InitialContext(); ! // NamingEnumeration bindings = ic.listBindings("java:comp/env"); ! // while(bindings.hasMoreElements()) { ! // try { ! // Binding namePair = (Binding) bindings.nextElement(); ! // Logger.logDebug("Setting property " + namePair.getName() + " from env-entry to value '" + ((Object) namePair.getObject()).toString() + "'"); ! // props.setProperty(namePair.getName(), ((Object) namePair.getObject()).toString()); ! // } catch(ClassCastException cce) { ! // Logger.logError("ClassCastException while loading application properties.", cce); ! // } ! // } ! // } catch(NamingException ne) { ! // Logger.logError("NamingException while loading application properties.", ne); ! // } ! ! PropertiesFileHandler filePropertiesHandler = new PropertiesFileHandler(); ! filePropertiesHandler.addProperties("/itrackerApplication.properties"); ! filePropertiesHandler.addProperties("/itrackerVersion.properties"); ! Properties fileProps = filePropertiesHandler.getProperties(); ! for(Enumeration e = fileProps.propertyNames(); e.hasMoreElements(); ) { ! String propName = (String) e.nextElement(); ! Logger.logDebug("Setting property " + propName + " from file to value '" + fileProps.getProperty(propName) + "'"); ! props.setProperty(propName, fileProps.getProperty(propName)); ! } ! ! props.setProperty("start_time_millis", Long.toString(new java.util.Date().getTime())); ! ! /* try { ! InitialContext ic = new InitialContext(); ! try { ! DataSource ds = (DataSource) ic.lookup(props.getProperty("default_ds", SystemConfigurationUtilities.DEFAULT_DATASOURCE)); ! } catch(NamingException testne) { ! DataSource ds = (DataSource) ic.lookup("java:/" + props.getProperty("default_ds")); ! props.setProperty("default_ds", "java:/" + props.getProperty("default_ds")); ! Logger.logWarn("Error in datasource, changed to '" + props.getProperty("default_ds") + "'"); ! } ! } catch(NamingException ne) { ! Logger.logError("NamingException while checking DataSource.", ne); ! }*/ ! } ! ! // initialize Factories... ! cHome = SpringFactories.getConfigurationFactory(); ! lHome = SpringFactories.getLanguageFactory(); ! cfHome = SpringFactories.getCustomFieldFactory(); ! } ! ! public String getProperty(String name) { ! return props.getProperty(name); ! } ! ! public String getProperty(String name, String defaultValue) { ! return props.getProperty(name, defaultValue); ! } ! ! public boolean getBooleanProperty(String name, boolean defaultValue) { ! String value = props.getProperty(name); ! return (value == null ? defaultValue : new Boolean(value).booleanValue()); ! } ! ! public int getIntegerProperty(String name, int defaultValue) { ! String value = props.getProperty(name); ! try { ! return (value == null ? defaultValue : Integer.parseInt(value)); ! } catch(NumberFormatException nfe) { ! return defaultValue; ! } ! } ! ! public long getLongProperty(String name, long defaultValue) { ! String value = props.getProperty(name); ! try { ! return (value == null ? defaultValue : Long.parseLong(value)); ! } catch(NumberFormatException nfe) { ! return defaultValue; ! } ! } ! ! public Properties getProperties() { ! return props; ! } ! ! public ConfigurationModel getConfigurationItem(Integer id) { ! ConfigurationBean configItem = cHome.findByPrimaryKey(id); ! return configItem.getModel(); ! } ! ! public ConfigurationModel[] getConfigurationItemsByType(int type) throws DataException { ! ConfigurationModel[] items = new ConfigurationModel[0]; ! ! Collection configItems = cHome.findByType(type); ! items = new ConfigurationModel[configItems.size()]; ! int i = 0; ! for(Iterator iter = configItems.iterator(); iter.hasNext(); i++) { ! items[i] = ((ConfigurationBean) iter.next()).getModel(); ! } ! Arrays.sort(items, new ConfigurationModel()); ! ! return items; ! } ! ! public ConfigurationModel[] getConfigurationItemsByType(int type, Locale locale) throws DataException { ! ConfigurationModel[] items = getConfigurationItemsByType(type); ! for(int i = 0; i < items.length; i++) { ! if(items[i].getType() == SystemConfigurationUtilities.TYPE_STATUS) { ! items[i].setName(IssueUtilities.getStatusName(items[i].getValue(), locale)); ! } else if(items[i].getType() == SystemConfigurationUtilities.TYPE_SEVERITY) { ! items[i].setName(IssueUtilities.getSeverityName(items[i].getValue(), locale)); ! } else if(items[i].getType() == SystemConfigurationUtilities.TYPE_RESOLUTION) { ! items[i].setName(IssueUtilities.getResolutionName(items[i].getValue(), locale)); ! } ! } ! return items; ! } ! ! public ConfigurationModel createConfigurationItem(ConfigurationModel model) { ! ConfigurationBean configurationItem = new ConfigurationBean(); ! configurationItem.setModel(model); ! ! return configurationItem.getModel(); ! //Logger.logDebug("Unable to create new configuration item."); ! } ! ! public ConfigurationModel updateConfigurationItem(ConfigurationModel model) { ! if(model != null) { ! ConfigurationBean configurationItem = cHome.findByPrimaryKey(model.getId()); ! configurationItem.setModel(model); ! return configurationItem.getModel(); ! } ! return(null); ! } ! ! public ConfigurationModel[] updateConfigurationItems(ConfigurationModel[] models, int type) throws DataException { ! removeConfigurationItems(type); ! ! for(int i = 0; i < models.length; i++) { ! ConfigurationBean configurationItem = new ConfigurationBean(); ! configurationItem.setModel(models[i]); ! models[i] = configurationItem.getModel(); ! } ! ! Arrays.sort(models, new ConfigurationModel()); ! return models; ! //Logger.logDebug("Unable to create new language item."); ! ! //return new ConfigurationModel[0]; ! } ! ! public void removeConfigurationItem(Integer id) { ! //cHome.remove(id); ! //Logger.logDebug("Unable to remove configuration item " + id + "."); ! } ! ! public void removeConfigurationItems(int type) throws DataException { ! Collection currentItems = cHome.findByType(type); ! for(Iterator iter = currentItems.iterator(); iter.hasNext(); ) { ! ConfigurationBean config = (ConfigurationBean) iter.next(); ! ! //config.remove(); ! } ! } ! ! public void removeConfigurationItems(ConfigurationModel model) throws DataException { ! Vector currentIds = new Vector(); ! Collection currentItems = cHome.findByTypeAndValue(model.getType(), model.getValue()); ! for(Iterator iter = currentItems.iterator(); iter.hasNext(); ) { ! //((ConfigurationBean) iter.next()).remove(); ! } ! } ! ! public boolean configurationItemExists(ConfigurationModel model) throws DataException { ! if(model != null && model.getVersion() != null) { ! Collection configItems = cHome.findByTypeAndValue(model.getType(), model.getValue()); ! if(configItems != null && configItems.size() > 0) { ! return true; ! } ! } ! return false; ! } ! ! public boolean configurationItemUpToDate(ConfigurationModel model) throws DataException { ! long currentVersion = 0; ! ! if(model != null && model.getVersion() != null) { ! Collection configItems = cHome.findByTypeAndValue(model.getType(), model.getValue()); ! for(Iterator iter = configItems.iterator(); iter.hasNext(); ) { ! ConfigurationBean configItem = (ConfigurationBean) iter.next(); ! if(configItem != null) { ! currentVersion = Math.max(SystemConfigurationUtilities.getVersionAsLong(configItem.getVersion()), currentVersion); ! } ! } ! ! if(currentVersion >= SystemConfigurationUtilities.getVersionAsLong(model.getVersion())) { ! return true; ! } ! } ! ! return false; ! } ! ! public void resetConfigurationCache() throws DataException { ! IssueUtilities.setResolutions(getConfigurationItemsByType(SystemConfigurationUtilities.TYPE_RESOLUTION)); ! IssueUtilities.setSeverities(getConfigurationItemsByType(SystemConfigurationUtilities.TYPE_SEVERITY)); ! IssueUtilities.setStatuses(getConfigurationItemsByType(SystemConfigurationUtilities.TYPE_STATUS)); ! IssueUtilities.setCustomFields(getCustomFields()); ! } ! ! public void resetConfigurationCache(int type) throws DataException { ! if(type == SystemConfigurationUtilities.TYPE_RESOLUTION) { ! IssueUtilities.setResolutions(getConfigurationItemsByType(SystemConfigurationUtilities.TYPE_RESOLUTION)); ! } else if(type == SystemConfigurationUtilities.TYPE_SEVERITY) { ! IssueUtilities.setSeverities(getConfigurationItemsByType(SystemConfigurationUtilities.TYPE_SEVERITY)); ! } else if(type == SystemConfigurationUtilities.TYPE_STATUS) { ! IssueUtilities.setStatuses(getConfigurationItemsByType(SystemConfigurationUtilities.TYPE_STATUS)); ! } else if(type == SystemConfigurationUtilities.TYPE_CUSTOMFIELD) { ! IssueUtilities.setCustomFields(getCustomFields()); ! } ! } ! ! public WorkflowScriptModel getWorkflowScript(Integer id) { ! WorkflowScriptBean workflowScript = wsHome.findByPrimaryKey(id); ! return workflowScript.getModel(); ! } ! ! public WorkflowScriptModel[] getWorkflowScripts() { ! WorkflowScriptModel[] scripts = new WorkflowScriptModel[0]; ! ! Collection workflowScripts = wsHome.findAll(); ! scripts = new WorkflowScriptModel[workflowScripts.size()]; ! int i = 0; ! for(Iterator iter = workflowScripts.iterator(); iter.hasNext(); i++) { ! scripts[i] = ((WorkflowScriptBean) iter.next()).getModel(); ! } ! ! return scripts; ! } ! ! public WorkflowScriptModel createWorkflowScript(WorkflowScriptModel model) { ! //try { ! WorkflowScriptBean workflowScript = new WorkflowScriptBean(); ! workflowScript.setModel(model); ! model.setId(workflowScript.getId()); ! ! return workflowScript.getModel(); ! //} catch(CreateException ce) { ! //Logger.logDebug("Unable to create new workflow script.", ce); ! //} ! ! //return null; ! } ! ! public WorkflowScriptModel updateWorkflowScript(WorkflowScriptModel model) { ! if(model != null) { ! WorkflowScriptBean workflowScript = wsHome.findByPrimaryKey(model.getId()); ! workflowScript.setModel(model); ! ! return workflowScript.getModel(); ! } ! ! return null; ! } ! ! public CustomFieldModel getCustomField(Integer id) throws DataException { ! CustomFieldBean customField = cfHome.findByPrimaryKey(id); ! return customField.getModel(); ! } ! ! public CustomFieldModel[] getCustomFields() throws DataException { ! CustomFieldModel[] fields = new CustomFieldModel[0]; ! ! Collection customFields = cfHome.findAll(); ! fields = new CustomFieldModel[customFields.size()]; ! int i = 0; ! for(Iterator iter = customFields.iterator(); iter.hasNext(); i++) { ! fields[i] = ((CustomFieldBean) iter.next()).getModel(); ! } ! ! return fields; ! } ! ! public CustomFieldModel[] getCustomFields(Locale locale) throws DataException { ! CustomFieldModel[] fields = getCustomFields(); ! for(int i = 0; i < fields.length; i++) { ! fields[i].setLabels(locale); ! } ! ! return fields; ! } ! ! public CustomFieldModel createCustomField(CustomFieldModel model) throws DataException { ! CustomFieldBean customField = new CustomFieldBean(); ! customField.setModel(model); ! model.setId(customField.getId()); ! if(model.getOptions().length > 0) { ! removeCustomFieldValues(customField.getId()); ! CustomFieldValueModel[] newOptions = model.getOptions(); ! for(int i = 0; i < newOptions.length; i++) { ! newOptions[i].setCustomFieldId(customField.getId()); ! createCustomFieldValue(newOptions[i]); ! } ! } ! ! return customField.getModel(); ! ! //Logger.logDebug("Unable to create new custom field.", ce); ! } ! ! public CustomFieldModel updateCustomField(CustomFieldModel model) throws DataException { ! if(model != null) { ! CustomFieldBean customField = cfHome.findByPrimaryKey(model.getId()); ! customField.setModel(model); ! ! if(model.getOptions().length > 0) { ! removeCustomFieldValues(customField.getId()); ! CustomFieldValueModel[] newOptions = model.getOptions(); ! for(int i = 0; i < newOptions.length; i++) { ! createCustomFieldValue(newOptions[i]); ! } ! } ! return customField.getModel(); ! } ! return null; ! } ! ! public void removeCustomField(Integer customFieldId) throws DataException { ! CustomFieldBean customField = cfHome.findByPrimaryKey(customFieldId); ! //customField.remove(); ! } ! ! public CustomFieldValueModel getCustomFieldValue(Integer id) { ! // CustomFieldValueBean customFieldValue = cfvHome.findByPrimaryKey(id); ! // return customFieldValue.getModel(); ! return(null); ! } ! ! public CustomFieldValueModel createCustomFieldValue(CustomFieldValueModel model) throws DataException { ! if(model == null || model.getCustomFieldId() == null) { ! return null; ! } ! ! CustomFieldBean customField = cfHome.findByPrimaryKey(model.getCustomFieldId()); ! ! CustomFieldValueBean customFieldValue = new CustomFieldValueBean(); ! customFieldValue.setModel(model); ! customFieldValue.setCustomField(customField); ! return customFieldValue.getModel(); ! // Logger.logDebug("Unable to create new custom field value: " + ce.getMessage()); ! ! // Logger.logDebug("Unable to create new custom field value, custom field not found: " + fe.getMessage()); ! } ! ! public CustomFieldValueModel updateCustomFieldValue(CustomFieldValueModel model) { ! // if(model != null) { ! // CustomFieldValueBean customFieldValue = cfvHome.findByPrimaryKey(model.getId()); ! // customFieldValue.setModel(model); ! // return customFieldValue.getModel(); ! // } ! ! return null; ! } ! ! public CustomFieldValueModel[] updateCustomFieldValues(Integer customFieldId, CustomFieldValueModel[] models) throws DataException { ! CustomFieldValueModel[] values = new CustomFieldValueModel[0]; ! ! if(customFieldId != null) { ! CustomFieldBean customField = cfHome.findByPrimaryKey(customFieldId); ! Collection currValues = customField.getValues(); ! for(Iterator iter = currValues.iterator(); iter.hasNext(); ) { ! if(models == null || models.length == 0) { ! //((CustomFieldValueBean) iter.next()).remove(); ! } else { ! CustomFieldValueBean value = (CustomFieldValueBean) iter.next(); ! for(int i = 0; i < models.length; i++) { ! if(value.getId().equals(models[i].getId())) { ! value.setModel(models[i]); ! models[i] = value.getModel(); ! break; ! } ! } ! } ! } ! } ! ! Arrays.sort(models, new CustomFieldValueModel()); ! return models; ! } ! ! public void removeCustomFieldValue(Integer customFieldValueId) { ! ! //CustomFieldValueBean customFieldValue = cfvHome.findByPrimaryKey(customFieldValueId); ! //customFieldValue.remove(); ! } ! ! public void removeCustomFieldValues(Integer customFieldId) { ! // Collection currentValues = cfvHome.findByCustomField(customFieldId); ! // for(Iterator iter = currentValues.iterator(); iter.hasNext(); ) { ! // ! // //((CustomFieldValueBean) iter.next()).remove(); ! // } ! } ! ! public LanguageModel getLanguageItemByKey(String key, Locale locale) throws DataException { ! LanguageModel model = null; ! ! if(key != null) { ! LanguageBean languageItem = lHome.findByKeyAndLocale(key, ITrackerResources.BASE_LOCALE); ! model = languageItem.getModel(); ! ! if(locale != null && ! "".equals(locale.getLanguage())) { ! languageItem = lHome.findByKeyAndLocale(key, locale.getLanguage()); ! model = languageItem.getModel(); ! ! if(! "".equals(locale.getCountry())) { ! languageItem = lHome.findByKeyAndLocale(key, locale.toString()); ! model = languageItem.getModel(); ! } ! } ! } ! ! return model; ! } ! ! public LanguageModel[] getLanguageItemsByKey(String key) throws DataException { ! LanguageModel[] items = new LanguageModel[0]; ! ! Collection languageItems = lHome.findByKey(key); ! items = new LanguageModel[languageItems.size()]; ! int i = 0; ! for(Iterator iter = languageItems.iterator(); iter.hasNext(); i++) { ! items[i] = ((LanguageBean) iter.next()).getModel(); ! } ! ! return items; ! } ! ! public LanguageModel updateLanguageItem(LanguageModel model) throws DataException { ! LanguageBean languageItem; ! ! languageItem = lHome.findByKeyAndLocale(model.getResourceKey(), model.getLocale()); ! languageItem.setModel(model); ! //} catch(FinderException fe) { ! //languageItem = new LanguageBean(); ! languageItem.setModel(model); ! //} ! ! return languageItem.getModel(); ! ! //Logger.logDebug("Unable to create new language item.", ce); ! ! } ! ! public void removeLanguageKey(String key) throws DataException { ! Vector currentIds = new Vector(); ! Collection languageItems = lHome.findByKey(key); ! for(Iterator iter = languageItems.iterator(); iter.hasNext(); ) { ! currentIds.add(((LanguageBean) iter.next()).getId()); ! } ! for(int i = 0; i < currentIds.size(); i++) { ! //lHome.remove((Integer) currentIds.elementAt(i)); ! } ! // } catch(FinderException ce) { ! // Logger.logDebug("Unable to find any language items with key" + key + " for removal."); ! // } ! } ! ! public void removeLanguageItem(LanguageModel model) throws DataException { ! LanguageBean languageItem = lHome.findByKeyAndLocale(model.getResourceKey(), model.getLocale()); ! //lHome.remove(languageItem.getId()); ! //Logger.logDebug("Unable to remove language item " + model.toString() + "."); ! ! } ! ! public String[] getSortedKeys() throws DataException { ! String[] sortedKeys = new String[0]; ! ! int i = 0; ! Collection items = lHome.findByLocale(ITrackerResources.BASE_LOCALE); ! sortedKeys = new String[items.size()]; ! for(Iterator iter = items.iterator(); iter.hasNext(); i++) { ! LanguageBean item = (LanguageBean) iter.next(); ! sortedKeys[i] = item.getResourceKey(); ! } ! ! // Now sort the list of keys in a logical manner ! Arrays.sort(sortedKeys); ! ! return sortedKeys; ! } ! ! public HashMap getDefinedKeys(String locale) throws DataException { ! HashMap keys = new HashMap(); ! ! if(locale == null || locale.equals("")) { ! locale = ITrackerResources.BASE_LOCALE; ! } ! ! Collection items = lHome.findByLocale(locale); ! for(Iterator iter = items.iterator(); iter.hasNext(); ) { ! LanguageBean item = (LanguageBean) iter.next(); ! keys.put(item.getResourceKey(), item.getResourceValue()); ! } ! ! return keys; ! } ! ! public NameValuePairModel[] getDefinedKeysAsArray(String locale) throws DataException { ! NameValuePairModel[] keys = new NameValuePairModel[0]; ! ! if(locale == null || locale.equals("")) { ! locale = ITrackerResources.BASE_LOCALE; ! } ! ! int i = 0; ! Collection items = lHome.findByLocale(locale); ! keys = new NameValuePairModel[items.size()]; ! for(Iterator iter = items.iterator(); iter.hasNext(); i++) { ! LanguageBean item = (LanguageBean) iter.next(); ! keys[i] = new NameValuePairModel(item.getResourceKey(), item.getResourceValue()); ! } ! ! Arrays.sort(keys, new NameValuePairModel()); ! ! return keys; ! } ! ! public int getNumberDefinedKeys(String locale) throws DataException { ! return getDefinedKeys(locale).size(); ! } ! ! public LanguageModel[] getLanguage(Locale locale) throws DataException { ! LanguageModel[] languageArray = new LanguageModel[0]; ! HashMap language = new HashMap(); ! ! Collection baseItems = lHome.findByLocale(ITrackerResources.BASE_LOCALE); ! for(Iterator iterator = baseItems.iterator(); iterator.hasNext();) { ! LanguageBean item = (LanguageBean) iterator.next(); ! language.put(item.getResourceKey(), item.getResourceValue()); ! } ! ! if(locale != null && ! "".equals(locale.getLanguage())) { ! Collection languageItems = lHome.findByLocale(locale.getLanguage()); ! for(Iterator iterator = languageItems.iterator(); iterator.hasNext();) { ! LanguageBean item = (LanguageBean) iterator.next(); ! language.put(item.getResourceKey(), item.getResourceValue()); ! } ! ! if(! "".equals(locale.getCountry())) { ! Collection countryItems = lHome.findByLocale(locale.toString()); ! for(Iterator iterator = countryItems.iterator(); iterator.hasNext();) { ! LanguageBean item = (LanguageBean) iterator.next(); ! language.put(item.getResourceKey(), item.getResourceValue()); ! } ! } ! } ! ! languageArray = new LanguageModel[language.size()]; ! int i = 0; ! String localeString = (locale == null ? ITrackerResources.BASE_LOCALE : locale.toString()); ! for(Iterator iterator = language.keySet().iterator(); iterator.hasNext(); i++) { ! String key = (String) iterator.next(); ! languageArray[i] = new LanguageModel(localeString, key, (String) language.get(key)); ! } ! ! return languageArray; ! } ! ! public HashMap getAvailableLanguages() throws DataException { ! HashMap languages = new HashMap(); ! ! ConfigurationModel[] locales = getConfigurationItemsByType(SystemConfigurationUtilities.TYPE_LOCALE); ! for(int i = 0; i < locales.length; i++) { ! if(ITrackerResources.BASE_LOCALE.equalsIgnoreCase(locales[i].getValue())) { ! continue; ! } ! if(locales[i].getValue().length() == 2) { ! languages.put(locales[i].getValue(), new Vector()); ! } ! } ! for(int i = 0; i < locales.length; i++) { ! if(ITrackerResources.BASE_LOCALE.equalsIgnoreCase(locales[i].getValue())) { ! continue; ! } ! String locale = locales[i].getValue(); ! if(locale.length() == 5 && locale.indexOf('_') == 2) { ! String baseLanguage = locale.substring(0,2); ! Vector languageVector = (Vector) languages.get(baseLanguage); ! if(languageVector != null) { ! languageVector.addElement(locale); ! } ! } ! } ! return languages; ! } ! ! public int getNumberAvailableLanguages() throws DataException { ! int numLanguages = 0; ! ! HashMap availableLanguages = getAvailableLanguages(); ! for(Iterator iter = availableLanguages.keySet().iterator(); iter.hasNext(); ) { ! Vector language = (Vector) availableLanguages.get((String) iter.next()); ! if(language != null && language.size() > 0) { ! numLanguages += language.size(); ! } else { ! numLanguages += 1; ! } ! } ! ! return numLanguages; ! } ! ! ! public void updateLanguage(Locale locale, LanguageModel[] items) throws DataException { ! if(locale != null && items != null) { ! ConfigurationModel configItem = new ConfigurationModel(SystemConfigurationUtilities.TYPE_LOCALE, locale.toString(), props.getProperty("version")); ! updateLanguage(locale, items, configItem); ! } ! } ! ! public void updateLanguage(Locale locale, LanguageModel[] items, ConfigurationModel configItem) throws DataException { ! if(items == null || locale == null || configItem == null) { ! return; ! } ! ! for(int i = 0; i < items.length; i++) { ! if(items[i] != null) { ! if(items[i].getAction() == SystemConfigurationUtilities.ACTION_REMOVE) { ! removeLanguageItem(items[i]); ! } else { ! updateLanguageItem(items[i]); ! } ! } ! } ! removeConfigurationItems(configItem); ! createConfigurationItem(configItem); ! ! } ! ! public SystemConfigurationModel getSystemConfiguration(Locale locale) throws DataException { ! SystemConfigurationModel config = new SystemConfigurationModel(); ! ! // Load the basic system configuration ! ConfigurationModel[] resolutions = getConfigurationItemsByType(SystemConfigurationUtilities.TYPE_RESOLUTION); ! for(int i = 0; i < resolutions.length; i++) { ! resolutions[i].setName(ITrackerResources.getString(SystemConfigurationUtilities.getLanguageKey(resolutions[i]), locale)); ! } ! config.setResolutions(resolutions); ! ! ConfigurationModel[] severities = getConfigurationItemsByType(SystemConfigurationUtilities.TYPE_SEVERITY); ! for(int i = 0; i < severities.length; i++) { ! severities[i].setName(ITrackerResources.getString(SystemConfigurationUtilities.getLanguageKey(severities[i]), locale)); ! } ! config.setSeverities(severities); ! ! ConfigurationModel[] statuses = getConfigurationItemsByType(SystemConfigurationUtilities.TYPE_STATUS); ! for(int i = 0; i < statuses.length; i++) { ! statuses[i].setName(ITrackerResources.getString(SystemConfigurationUtilities.getLanguageKey(statuses[i]), locale)); ! } ! config.setStatuses(statuses); ! ! // Now load the CustomFields ! config.setCustomFields(IssueUtilities.getCustomFields(locale)); ! ! // Now set the system version ! config.setVersion(props.getProperty("version")); ! ! return config; ! } ! ! public boolean initializeLocale(String locale, boolean forceReload) throws DataException { ! boolean result = false; ! ! ConfigurationModel localeConfig = new ConfigurationModel(SystemConfigurationUtilities.TYPE_LOCALE, locale, props.getProperty("version")); ! if(! configurationItemUpToDate(localeConfig) || forceReload) { ! Logger.logDebug("Loading database with locale " + locale); ! PropertiesFileHandler localePropertiesHandler = new PropertiesFileHandler("/cowsultants/itracker/ejb/client/resources/ITracker" + (ITrackerResources.BASE_LOCALE.equals(locale) ? "" : "_" + locale) + ".properties"); ! if(localePropertiesHandler.hasProperties()) { ! Properties localeProperties = localePropertiesHandler.getProperties(); ! Logger.logDebug("Locale " + locale + " contains " + localeProperties.size() + " properties."); ! for(Enumeration propertiesEnumeration = localeProperties.propertyNames(); propertiesEnumeration.hasMoreElements(); ) { ! String key = (String) propertiesEnumeration.nextElement(); ! String value = localeProperties.getProperty(key); ! updateLanguageItem(new LanguageModel(locale, key, value)); ! } ! removeConfigurationItems(localeConfig); ! createConfigurationItem(localeConfig); ! ITrackerResources.clearBundle(ITrackerResources.getLocale(locale)); ! result = true; ! } else { ! Logger.logInfo("Locale " + locale + " contained no properties."); ! } ! } ! return result; ! } ! ! public void initializeConfiguration() { ! // Need to eventually add in code that detects the current version of the config and update ! // if necessary ! ! try { ! ConfigurationModel[] initialized = getConfigurationItemsByType(SystemConfigurationUtilities.TYPE_INITIALIZED); ! if(initialized == null || initialized.length != 1) { ! Logger.logDebug("System does not appear to be initialized, initializing system configuration."); ! LanguageModel[] baseLanguage = getLanguage(ITrackerResources.getLocale(ITrackerResources.BASE_LOCALE)); ! if(baseLanguage == null || baseLanguage.length == 0) { ! throw new SystemConfigurationException("Languages must be initialized before the system configuration can be loaded."); ! } ! ! // Remove any previous configuration information, possibly left over from previous failed initialization ! Logger.logDebug("Removing previous incomplete initialization information."); ! removeConfigurationItems(SystemConfigurationUtilities.TYPE_STATUS); ! removeConfigurationItems(SystemConfigurationUtilities.TYPE_SEVERITY); ! removeConfigurationItems(SystemConfigurationUtilities.TYPE_RESOLUTION); ! ! for(int i = 0; i < baseLanguage.length; i++) { ! if(baseLanguage[i].getResourceKey().startsWith(ITrackerResources.KEY_BASE_RESOLUTION)) { ! try { ! String resolutionString = baseLanguage[i].getResourceKey().substring(20); ! Logger.logDebug("Adding new configuration resolution value: " + resolutionString); ! int resolutionNumber = Integer.parseInt(resolutionString); ! createConfigurationItem(new ConfigurationModel(SystemConfigurationUtilities.TYPE_RESOLUTION, resolutionString, props.getProperty("version"), resolutionNumber)); ! } catch(Exception e) { ! Logger.logError("Unable to load resolution value: " + baseLanguage[i].getResourceKey(), e); ! } ! } ! if(baseLanguage[i].getResourceKey().startsWith(ITrackerResources.KEY_BASE_SEVERITY)) { ! try { ! String severityString = baseLanguage[i].getResourceKey().substring(18); ! Logger.logDebug("Adding new configuration severity value: " + severityString); ! int severityNumber = Integer.parseInt(severityString); ! createConfigurationItem(new ConfigurationModel(SystemConfigurationUtilities.TYPE_SEVERITY, severityString, props.getProperty("version"), severityNumber)); ! } catch(Exception e) { ! Logger.logError("Unable to load severity value: " + baseLanguage[i].getResourceKey(), e); ! } ! } ! if(baseLanguage[i].getResourceKey().startsWith(ITrackerResources.KEY_BASE_STATUS)) { ! try { ! String statusString = baseLanguage[i].getResourceKey().substring(16); ! Logger.logDebug("Adding new configuration status value: " + statusString); ! int statusNumber = Integer.parseInt(statusString); ! createConfigurationItem(new ConfigurationModel(SystemConfigurationUtilities.TYPE_STATUS, statusString, props.getProperty("version"), statusNumber)); ! } catch(Exception e) { ! Logger.logError("Unable to load status value: " + baseLanguage[i].getResourceKey(), e); ! } ! } ! } ! createConfigurationItem(new ConfigurationModel(SystemConfigurationUtilities.TYPE_INITIALIZED, "1", props.getProperty("version"))); ! } ! } catch(Exception e) { ! Logger.logError("Unable to initialize system configuration.", e); ! } ! } ! ! } --- 1 ---- ! /* * This software was designed and created by Jason Carroll. * Copyright (c) 2002, 2003, 2004 Jason Carroll. * The author can be reached at jca...@co... * ITracker website: http://www.cowsultants.com * ITracker forums: http://www.cowsultants.com/phpBB/index.php * * This program is free software; you can redistribute it and/or modify * it only under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ package cowsultants.itracker.ejb.beans.session; import java.sql.Timestamp; import java.util.Arrays; import java.util.Date; import java.util.Collection; import java.util.Enumeration; import java.util.HashMap; import java.util.Iterator; import java.util.Locale; import java.util.Properties; import java.util.Vector; import javax.naming.InitialContext; import cowsultants.itracker.ejb.beans.entity.ConfigurationBean; import cowsultants.itracker.ejb.beans.entity.CustomFieldBean; import cowsultants.itracker.ejb.beans.entity.CustomFieldValueBean; import cowsultants.itracker.ejb.beans.entity.LanguageBean; import cowsultants.itracker.ejb.beans.entity.WorkflowScriptBean; import cowsultants.itracker.ejb.client.exceptions.SystemConfigurationException; import cowsultants.itracker.ejb.client.interfaces.SystemConfiguration; import cowsultants.itracker.ejb.client.models.ConfigurationModel; import cowsultants.itracker.ejb.client.models.CustomFieldModel; import cowsultants.itracker.ejb.client.models.CustomFieldValueModel; import cowsultants.itracker.ejb.client.models.LanguageModel; import cowsultants.itracker.ejb.client.models.NameValuePairModel; import cowsultants.itracker.ejb.client.models.SystemConfigurationModel; import cowsultants.itracker.ejb.client.models.WorkflowScriptModel; import cowsultants.itracker.ejb.client.resources.ITrackerResources; import cowsultants.itracker.ejb.client.util.IssueUtilities; import cowsultants.itracker.ejb.client.util.Logger; import cowsultants.itracker.ejb.client.util.SystemConfigurationUtilities; import cowsultants.itracker.ejb.util.PropertiesFileHandler; /** * * Implimetation of the SystemConfiguration Interface. * * @see SystemConfiguration * */ public class SystemConfigurationBean implements SystemConfiguration { private static Properties props = null; InitialContext ic = null; ConfigurationFactory cHome = null; CustomFieldFactory cfHome = null; CustomFieldValueFactory cfvHome = null; LanguageFactory lHome = null; WorkflowScriptFactory wsHome = null; public SystemConfigurationBean() { if (props == null) { props = new Properties(); // try { // ic = new InitialContext(); // NamingEnumeration bindings = ic.listBindings("java:comp/env"); // while(bindings.hasMoreElements()) { // try { // Binding namePair = (Binding) bindings.nextElement(); // Logger.logDebug("Setting property " + namePair.getName() + " from // env-entry to value '" + ((Object) // namePair.getObject()).toString() + "'"); // props.setProperty(namePair.getName(), ((Object) // namePair.getObject()).toString()); // } catch(ClassCastException cce) { // Logger.logError("ClassCastException while loading application // properties.", cce); // } // } // } catch(NamingException ne) { // Logger.logError("NamingException while loading application // properties.", ne); // } PropertiesFileHandler filePropertiesHandler = new PropertiesFileHandler(); filePropertiesHandler.addProperties("/itrackerApplication.properties"); filePropertiesHandler.addProperties("/itrackerVersion.properties"); Properties fileProps = filePropertiesHandler.getProperties(); for (Enumeration e = fileProps.propertyNames(); e.hasMoreElements();) { String propName = (String) e.nextElement(); Logger.logDebug("Setting property " + propName + " from file to value '" + fileProps.getProperty(propName) + "'"); props.setProperty(propName, fileProps.getProperty(propName)); } props.setProperty("start_time_millis", Long.toString(new java.util.Date().getTime())); /* * try { * * InitialContext ic = new InitialContext(); * * try { * * DataSource ds = (DataSource) * ic.lookup(props.getProperty("default_ds", * SystemConfigurationUtilities.DEFAULT_DATASOURCE)); * } catch(NamingException testne) { * * DataSource ds = (DataSource) ic.lookup("java:/" + * props.getProperty("default_ds")); * * props.setProperty("default_ds", "java:/" + * props.getProperty("default_ds")); * * Logger.logWarn("Error in datasource, changed to '" + * props.getProperty("default_ds") + "'"); * } * } catch(NamingException ne) { * * Logger.logError("NamingException while checking DataSource.", * ne); * } */ } // initialize Factories... cHome = SpringFactories.getConfigurationFactory(); lHome = SpringFactories.getLanguageFactory(); cfHome = SpringFactories.getCustomFieldFactory(); } public String getProperty(String name) { return props.getProperty(name); } public String getProperty(String name, String defaultValue) { return props.getProperty(name, defaultValue); } public boolean getBooleanProperty(String name, boolean defaultValue) { String value = props.getProperty(name); return (value == null ? defaultValue : new Boolean(value).booleanValue()); } public int getIntegerProperty(String name, int defaultValue) { String value = props.getProperty(name); try { return (value == null ? defaultValue : Integer.parseInt(value)); } catch (NumberFormatException nfe) { return defaultValue; } } public long getLongProperty(String name, long defaultValue) { String value = props.getProperty(name); try { return (value == null ? defaultValue : Long.parseLong(value)); } catch (NumberFormatException nfe) { return defaultValue; } } public Properties getProperties() { return props; } public ConfigurationModel getConfigurationItem(Integer id) { ConfigurationBean configItem = cHome.findByPrimaryKey(id); return configItem.getModel(); } public ConfigurationModel[] getConfigurationItemsByType(int type) throws DataException { ConfigurationModel[] items = new ConfigurationModel[0]; Collection configItems = cHome.findByType(type); items = new ConfigurationModel[configItems.size()]; int i = 0; for (Iterator iter = configItems.iterator(); iter.hasNext(); i++) { items[i] = ((ConfigurationBean) iter.next()).getModel(); } Arrays.sort(items, new ConfigurationModel()); return items; } public ConfigurationModel[] getConfigurationItemsByType(int type, Locale locale) throws DataException { ConfigurationModel[] items = getConfigurationItemsByType(type); for (int i = 0; i < items.length; i++) { if (items[i].getType() == SystemConfigurationUtilities.TYPE_STATUS) { items[i].setName(IssueUtilities.getStatusName(items[i].getValue(), locale)); } else if (items[i].getType() == SystemConfigurationUtilities.TYPE_SEVERITY) { items[i].setName(IssueUtilities.getSeverityName(items[i].getValue(), locale)); } else if (items[i].getType() == SystemConfigurationUtilities.TYPE_RESOLUTION) { items[i].setName(IssueUtilities.getResolutionName(items[i].getValue(), locale)); } } return items; } public ConfigurationModel createConfigurationItem(ConfigurationModel model) { ConfigurationBean configurationItem = new ConfigurationBean(); configurationItem.setModel(model); return configurationItem.getModel(); // Logger.logDebug("Unable to create new configuration item."); } public ConfigurationModel updateConfigurationItem(ConfigurationModel model) { if (model != null) { ConfigurationBean configurationItem = cHome.findByPrimaryKey(model.getId()); configurationItem.setModel(model); return configurationItem.getModel(); } return (null); } public ConfigurationModel[] updateConfigurationItems(ConfigurationModel[] models, int type) throws DataException { removeConfigurationItems(type); for (int i = 0; i < models.length; i++) { ConfigurationBean configurationItem = new ConfigurationBean(); configurationItem.setModel(models[i]); models[i] = configurationItem.getModel(); } Arrays.sort(models, new ConfigurationModel()); return models; // Logger.logDebug("Unable to create new language item."); // return new ConfigurationModel[0]; } public void removeConfigurationItem(Integer id) { // cHome.remove(id); // Logger.logDebug("Unable to remove configuration item " + id + "."); } public void removeConfigurationItems(int type) throws DataException { Collection currentItems = cHome.findByType(type); for (Iterator iter = currentItems.iterator(); iter.hasNext();) { ConfigurationBean config = (ConfigurationBean) iter.next(); // config.remove(); } } public void removeConfigurationItems(ConfigurationModel model) throws DataException { Vector currentIds = new Vector(); Collection currentItems = cHome.findByTypeAndValue(model.getType(), model.getValue()); for (Iterator iter = currentItems.iterator(); iter.hasNext();) { // ((ConfigurationBean) iter.next()).remove(); } } public boolean configurationItemExists(ConfigurationModel model) throws DataException { if (model != null && model.getVersion() != null) { Collection configItems = cHome.findByTypeAndValue(model.getType(), model.getValue()); if (configItems != null && configItems.size() > 0) { return true; } } return false; } public boolean configurationItemUpToDate(ConfigurationModel model) throws DataException { long currentVersion = 0; if (model != null && model.getVersion() != null) { Collection configItems = cHome.findByTypeAndValue(model.getType(), model.getValue()); for (Iterator iter = configItems.iterator(); iter.hasNext();) { ConfigurationBean configItem = (ConfigurationBean) iter.next(); if (configItem != null) { currentVersion = Math.max(SystemConfigurationUtilities.getVersionAsLong(configItem.getVersion()), currentVersion); } } if (currentVersion >= SystemConfigurationUtilities.getVersionAsLong(model.getVersion())) { return true; } } return false; } public void resetConfigurationCache() throws DataException { IssueUtilities.setResolutions(getConfigurationItemsByType(SystemConfigurationUtilities.TYPE_RESOLUTION)); IssueUtilities.setSeverities(getConfigurationItemsByType(SystemConfigurationUtilities.TYPE_SEVERITY)); IssueUtilities.setStatuses(getConfigurationItemsByType(SystemConfigurationUtilities.TYPE_STATUS)); IssueUtilities.setCustomFields(getCustomFields()); } public void resetConfigurationCache(int type) throws DataException { if (type == SystemConfigurationUtilities.TYPE_RESOLUTION) { IssueUtilities.setResolutions(getConfigurationItemsByType(SystemConfigurationUtilities.TYPE_RESOLUTION)); } else if (type == SystemConfigurationUtilities.TYPE_SEVERITY) { IssueUtilities.setSeverities(getConfigurationItemsByType(SystemConfigurationUtilities.TYPE_SEVERITY)); } else if (type == SystemConfigurationUtilities.TYPE_STATUS) { IssueUtilities.setStatuses(getConfigurationItemsByType(SystemConfigurationUtilities.TYPE_STATUS)); } else if (type == SystemConfigurationUtilities.TYPE_CUSTOMFIELD) { IssueUtilities.setCustomFields(getCustomFields()); } } public WorkflowScriptModel getWorkflowScript(Integer id) { WorkflowScriptBean workflowScript = wsHome.findByPrimaryKey(id); return workflowScript.getModel(); } public WorkflowScriptModel[] getWorkflowScripts() { WorkflowScriptModel[] scripts = new WorkflowScriptModel[0]; Collection workflowScripts = wsHome.findAll(); scripts = new WorkflowScriptModel[workflowScripts.size()]; int i = 0; for (Iterator iter = workflowScripts.iterator(); iter.hasNext(); i++) { scripts[i] = ((WorkflowScriptBean) iter.next()).getModel(); } return scripts; } public WorkflowScriptModel createWorkflowScript(WorkflowScriptModel model) { // try { WorkflowScriptBean workflowScript = new WorkflowScriptBean(); workflowScript.setModel(model); model.setId(workflowScript.getId()); return workflowScript.getModel(); // } catch(CreateException ce) { // Logger.logDebug("Unable to create new workflow script.", ce); // } // return null; } public WorkflowScriptModel updateWorkflowScript(WorkflowScriptModel model) { if (model != null) { WorkflowScriptBean workflowScript = wsHome.findByPrimaryKey(model.getId()); workflowScript.setModel(model); return workflowScript.getModel(); } return null; } public CustomFieldModel getCustomField(Integer id) throws DataException { CustomFieldBean customField = cfHome.findByPrimaryKey(id); return customField.getModel(); } public CustomFieldModel[] getCustomFields() throws DataException { CustomFieldModel[] fields = new CustomFieldModel[0]; Collection customFields = cfHome.findAll(); fields = new CustomFieldModel[customFields.size()]; int i = 0; for (Iterator iter = customFields.iterator(); iter.hasNext(); i++) { fields[i] = ((CustomFieldBean) iter.next()).getModel(); } return fields; } public CustomFieldModel[] getCustomFields(Locale locale) throws DataException { CustomFieldModel[] fields = getCustomFields(); for (int i = 0; i < fields.length; i++) { fields[i].setLabels(locale); } return fields; } public CustomFieldModel createCustomField(CustomFieldModel model) throws DataException { CustomFieldBean customField = new CustomFieldBean(); customField.setModel(model); model.setId(customField.getId()); if (model.getOptions().length > 0) { removeCustomFieldValues(customField.getId()); CustomFieldValueModel[] newOptions = model.getOptions(); for (int i = 0; i < newOptions.length; i++) { newOptions[i].setCustomFieldId(customField.getId()); createCustomFieldValue(newOptions[i]); } } return customField.getModel(); // Logger.logDebug("Unable to create new custom field.", ce); } public CustomFieldModel updateCustomField(CustomFieldModel model) throws DataException { if (model != null) { CustomFieldBean customField = cfHome.findByPrimaryKey(model.getId()); customField.setModel(model); if (model.getOptions().length > 0) { removeCustomFieldValues(customField.getId()); CustomFieldValueModel[] newOptions = model.getOptions(); for (int i = 0; i < newOptions.length; i++) { createCustomFieldValue(newOptions[i]); } } return customField.getModel(); } return null; } public void removeCustomField(Integer customFieldId) throws DataException { CustomFieldBean customField = cfHome.findByPrimaryKey(customFieldId); // customField.remove(); } public CustomFieldValueModel getCustomFieldValue(Integer id) { // CustomFieldValueBean customFieldValue = cfvHome.findByPrimaryKey(id); // return customFieldValue.getModel(); return (null); } public CustomFieldValueModel createCustomFieldValue(CustomFieldValueModel model) throws DataException { if (model == null || model.getCustomFieldId() == null) { return null; } CustomFieldBean customField = cfHome.findByPrimaryKey(model.getCustomFieldId()); CustomFieldValueBean customFieldValue = new CustomFieldValueBean(); customFieldValue.setModel(model); customFieldValue.setCustomField(customField); return customFieldValue.getModel(); // Logger.logDebug("Unable to create new custom field value: " + // ce.getMessage()); // Logger.logDebug("Unable to create new custom field value, custom // field not found: " + fe.getMessage()); } public CustomFieldValueModel updateCustomFieldValue(CustomFieldValueModel model) { // if(model != null) { // CustomFieldValueBean customFieldValue = // cfvHome.findByPrimaryKey(model.getId()); // customFieldValue.setModel(model); // return customFieldValue.getModel(); // } return null; } public CustomFieldValueModel[] updateCustomFieldValues(Integer customFieldId, CustomFieldValueModel[] models) throws DataException { CustomFieldValueModel[] values = new CustomFieldValueModel[0]; if (customFieldId != null) { CustomFieldBean customField = cfHome.findByPrimaryKey(customFieldId); Collection currValues = customField.getValues(); for (Iterator iter = currValues.iterator(); iter.hasNext();) { if (models == null || models.length == 0) { // ((CustomFieldValueBean) iter.next()).remove(); } else { CustomFieldValueBean value = (CustomFieldValueBean) iter.next(); for (int i = 0; i < models.length; i++) { if (value.getId().equals(models[i].getId())) { value.setModel(models[i]); models[i] = value.getModel(); break; } } } } } Arrays.sort(models, new CustomFieldValueModel()); return models; } public void removeCustomFieldValue(Integer customFieldValueId) { // CustomFieldValueBean customFieldValue = // cfvHome.findByPrimaryKey(customFieldValueId); // customFieldValue.remove(); } public void removeCustomFieldValues(Integer customFieldId) { // Collection currentValues = cfvHome.findByCustomField(customFieldId); // for(Iterator iter = currentValues.iterator(); iter.hasNext(); ) { // // //((CustomFieldValueBean) iter.next()).remove(); // } } public LanguageModel getLanguageItemByKey(String key, Locale locale) throws DataException { LanguageModel model = null; if (key != null) { LanguageBean languageItem = lHome.findByKeyAndLocale(key, ITrackerResources.BASE_LOCALE); model = languageItem.getModel(); if (locale != null && !"".equals(locale.getLanguage())) { languageItem = lHome.findByKeyAndLocale(key, locale.getLanguage()); model = languageItem.getModel(); if (!"".equals(locale.getCountry())) { languageItem = lHome.findByKeyAndLocale(... [truncated message content] |
From: Ricardo T. <rj...@us...> - 2005-10-18 21:20:47
|
Update of /cvsroot/itracker/itracker/src/cowsultants/itracker/ejb/beans/entity In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1667/cowsultants/itracker/ejb/beans/entity Modified Files: Tag: itrackerhibernate languagebean.hbm.xml Log Message: fixed loading db on startup Index: languagebean.hbm.xml =================================================================== RCS file: /cvsroot/itracker/itracker/src/cowsultants/itracker/ejb/beans/entity/Attic/languagebean.hbm.xml,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** languagebean.hbm.xml 11 Oct 2005 01:36:07 -0000 1.1.2.1 --- languagebean.hbm.xml 18 Oct 2005 21:20:40 -0000 1.1.2.2 *************** *** 7,12 **** <class name="cowsultants.itracker.ejb.beans.entity.LanguageBean"> ! <id name="id" column="id" type="int" unsaved-value="null"> ! <generator class="identity"/> </id> <property name="createDate" column="create_date" not-null="true" unique="false"/> --- 7,12 ---- <class name="cowsultants.itracker.ejb.beans.entity.LanguageBean"> ! <id name="id" type="java.lang.Integer" unsaved-value="null"> ! <generator class="native"/> </id> <property name="createDate" column="create_date" not-null="true" unique="false"/> |
From: Ricardo T. <rj...@us...> - 2005-10-18 20:48:08
|
Update of /cvsroot/itracker/itracker/src/cowsultants/itracker/ejb/beans/session In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26246 Modified Files: Tag: itrackerhibernate LanguageFactoryImpl.java Log Message: fixed obtaining language keys Index: LanguageFactoryImpl.java =================================================================== RCS file: /cvsroot/itracker/itracker/src/cowsultants/itracker/ejb/beans/session/Attic/LanguageFactoryImpl.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** LanguageFactoryImpl.java 11 Oct 2005 01:36:08 -0000 1.1.2.1 --- LanguageFactoryImpl.java 18 Oct 2005 20:47:56 -0000 1.1.2.2 *************** *** 6,15 **** import net.sf.hibernate.HibernateException; import net.sf.hibernate.expression.Expression; - - import org.springframework.orm.hibernate.support.HibernateDaoSupport; - import cowsultants.itracker.ejb.beans.entity.LanguageBean; ! public class LanguageFactoryImpl extends HibernateDaoSupport implements LanguageFactory { public LanguageBean findByKeyAndLocale(String key, String base_locale) throws DataException { --- 6,12 ---- import net.sf.hibernate.HibernateException; import net.sf.hibernate.expression.Expression; import cowsultants.itracker.ejb.beans.entity.LanguageBean; ! public class LanguageFactoryImpl extends BaseHibernateFactoryImpl implements LanguageFactory { public LanguageBean findByKeyAndLocale(String key, String base_locale) throws DataException { *************** *** 18,22 **** criteria.add(Expression.eq("locale", base_locale)); try { ! return ((LanguageBean)criteria.uniqueResult()); } catch (HibernateException e) { throw new DataException(e); --- 15,22 ---- criteria.add(Expression.eq("locale", base_locale)); try { ! LanguageBean language = (LanguageBean) criteria.uniqueResult(); ! if(language == null) ! throw new NoSuchEntityException("No language item for " + key + " " + base_locale); ! return (language); } catch (HibernateException e) { throw new DataException(e); |
From: Ricardo T. <rj...@us...> - 2005-10-18 20:47:13
|
Update of /cvsroot/itracker/itracker/src/cowsultants/itracker/ejb/beans/session In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25941 Modified Files: Tag: itrackerhibernate IssueSearchBean.java Log Message: moved ejbCreate to constructor Index: IssueSearchBean.java =================================================================== RCS file: /cvsroot/itracker/itracker/src/cowsultants/itracker/ejb/beans/session/IssueSearchBean.java,v retrieving revision 1.25.2.1 retrieving revision 1.25.2.2 diff -C2 -d -r1.25.2.1 -r1.25.2.2 *** IssueSearchBean.java 11 Oct 2005 01:21:04 -0000 1.25.2.1 --- IssueSearchBean.java 18 Oct 2005 20:47:05 -0000 1.25.2.2 *************** *** 27,35 **** import javax.ejb.CreateException; - import javax.ejb.SessionBean; - import javax.ejb.SessionContext; import javax.naming.InitialContext; import javax.naming.NamingException; - import javax.rmi.PortableRemoteObject; import javax.sql.DataSource; --- 27,32 ---- *************** *** 37,40 **** --- 34,38 ---- import cowsultants.itracker.ejb.client.interfaces.IssueHandler; import cowsultants.itracker.ejb.client.interfaces.IssueHandlerHome; + import cowsultants.itracker.ejb.client.interfaces.IssueSearch; import cowsultants.itracker.ejb.client.interfaces.SystemConfiguration; import cowsultants.itracker.ejb.client.models.IssueModel; *************** *** 47,51 **** ! public class IssueSearchBean implements SessionBean { private static String componentbeanTableName; private static String componentbeanRelTableName; --- 45,49 ---- ! public class IssueSearchBean implements IssueSearch { private static String componentbeanTableName; private static String componentbeanRelTableName; *************** *** 61,64 **** --- 59,83 ---- private IssueHandlerHome ihHome = null; + public IssueSearchBean() { + try { + ic = new InitialContext(); + ihHome = null; + + SystemConfiguration sc = new SystemConfigurationBean(); + + componentbeanTableName = sc.getProperty("componentbean_table_name", SystemConfigurationUtilities.DEFAULT_COMPONENTBEAN_TABLE_NAME); + componentbeanRelTableName = sc.getProperty("componentbean_rel_table_name", SystemConfigurationUtilities.DEFAULT_COMPONENTBEAN_REL_TABLE_NAME); + issuebeanTableName = sc.getProperty("issuebean_table_name", SystemConfigurationUtilities.DEFAULT_ISSUEBEAN_TABLE_NAME); + issuehistorybeanTableName = sc.getProperty("issuehistorybean_table_name", SystemConfigurationUtilities.DEFAULT_ISSUEHISTORYBEAN_TABLE_NAME); + projectbeanTableName = sc.getProperty("projectbean_table_name", SystemConfigurationUtilities.DEFAULT_PROJECTBEAN_TABLE_NAME); + versionbeanTableName = sc.getProperty("versionbean_table_name", SystemConfigurationUtilities.DEFAULT_VERSIONBEAN_TABLE_NAME); + versionbeanRelTableName = sc.getProperty("versionbean_rel_table_name", SystemConfigurationUtilities.DEFAULT_VERSIONBEAN_REL_TABLE_NAME); + + ds = (DataSource) ic.lookup(sc.getProperty("default_ds", SystemConfigurationUtilities.DEFAULT_DATASOURCE)); + } catch(NamingException ne) { + Logger.logError("Exception while looking up home interfaces.", ne); + } + } + public IssueModel[] searchIssues(IssueSearchQueryModel queryModel, UserModel user, HashMap permissions) throws IssueSearchException, DataException { Connection conn = null; *************** *** 206,236 **** } } - - public void ejbCreate() { - try { - ic = new InitialContext(); - Object ihRef = ic.lookup("java:comp/env/" + IssueHandler.JNDI_NAME); - ihHome = (IssueHandlerHome) PortableRemoteObject.narrow(ihRef, IssueHandlerHome.class); - - SystemConfiguration sc = new SystemConfigurationBean(); - - componentbeanTableName = sc.getProperty("componentbean_table_name", SystemConfigurationUtilities.DEFAULT_COMPONENTBEAN_TABLE_NAME); - componentbeanRelTableName = sc.getProperty("componentbean_rel_table_name", SystemConfigurationUtilities.DEFAULT_COMPONENTBEAN_REL_TABLE_NAME); - issuebeanTableName = sc.getProperty("issuebean_table_name", SystemConfigurationUtilities.DEFAULT_ISSUEBEAN_TABLE_NAME); - issuehistorybeanTableName = sc.getProperty("issuehistorybean_table_name", SystemConfigurationUtilities.DEFAULT_ISSUEHISTORYBEAN_TABLE_NAME); - projectbeanTableName = sc.getProperty("projectbean_table_name", SystemConfigurationUtilities.DEFAULT_PROJECTBEAN_TABLE_NAME); - versionbeanTableName = sc.getProperty("versionbean_table_name", SystemConfigurationUtilities.DEFAULT_VERSIONBEAN_TABLE_NAME); - versionbeanRelTableName = sc.getProperty("versionbean_rel_table_name", SystemConfigurationUtilities.DEFAULT_VERSIONBEAN_REL_TABLE_NAME); - - ds = (DataSource) ic.lookup(sc.getProperty("default_ds", SystemConfigurationUtilities.DEFAULT_DATASOURCE)); - } catch(NamingException ne) { - Logger.logError("Exception while looking up home interfaces.", ne); - } - } - - public void setSessionContext(SessionContext value) {} - public void ejbActivate() {} - public void ejbPassivate() {} - public void ejbRemove() {} } \ No newline at end of file --- 225,228 ---- |
From: Ricardo T. <rj...@us...> - 2005-10-18 20:39:08
|
Update of /cvsroot/itracker/itracker/src/cowsultants/itracker/web/actions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23613/actions Modified Files: Tag: itrackerhibernate InitializeLanguagesAction.java SearchIssuesAction.java Log Message: fixing initial language loading Index: InitializeLanguagesAction.java =================================================================== RCS file: /cvsroot/itracker/itracker/src/cowsultants/itracker/web/actions/InitializeLanguagesAction.java,v retrieving revision 1.6.4.2 retrieving revision 1.6.4.3 diff -C2 -d -r1.6.4.2 -r1.6.4.3 *** InitializeLanguagesAction.java 16 Oct 2005 12:08:45 -0000 1.6.4.2 --- InitializeLanguagesAction.java 18 Oct 2005 20:38:49 -0000 1.6.4.3 *************** *** 55,59 **** try { - //SystemConfigurationHome scHome = (SystemConfigurationHome) PortableRemoteObject.narrow(scRef, SystemConfigurationHome.class); SystemConfiguration sc = new SystemConfigurationBean(); --- 55,58 ---- Index: SearchIssuesAction.java =================================================================== RCS file: /cvsroot/itracker/itracker/src/cowsultants/itracker/web/actions/SearchIssuesAction.java,v retrieving revision 1.16.4.2 retrieving revision 1.16.4.3 diff -C2 -d -r1.16.4.2 -r1.16.4.3 *** SearchIssuesAction.java 13 Oct 2005 13:24:06 -0000 1.16.4.2 --- SearchIssuesAction.java 18 Oct 2005 20:38:49 -0000 1.16.4.3 *************** *** 38,41 **** --- 38,42 ---- import org.apache.struts.validator.DynaValidatorForm; + import cowsultants.itracker.ejb.beans.session.IssueSearchBean; import cowsultants.itracker.ejb.client.exceptions.IssueSearchException; import cowsultants.itracker.ejb.client.interfaces.IssueSearch; *************** *** 68,76 **** try { ! InitialContext ic = new InitialContext(); ! ! Object isRef = ic.lookup("java:comp/env/" + IssueSearch.JNDI_NAME); ! IssueSearchHome isHome = (IssueSearchHome) PortableRemoteObject.narrow(isRef, IssueSearchHome.class); ! IssueSearch is = isHome.create(); IssueSearchQueryModel isqm = (IssueSearchQueryModel) session.getAttribute(Constants.SEARCH_QUERY_KEY); --- 69,73 ---- try { ! IssueSearch is = new IssueSearchBean(); IssueSearchQueryModel isqm = (IssueSearchQueryModel) session.getAttribute(Constants.SEARCH_QUERY_KEY); |
From: Ricardo T. <rj...@us...> - 2005-10-18 20:39:00
|
Update of /cvsroot/itracker/itracker/src/cowsultants/itracker/web/servlets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23613/servlets Modified Files: Tag: itrackerhibernate ApplicationInitialization.java Log Message: fixing initial language loading Index: ApplicationInitialization.java =================================================================== RCS file: /cvsroot/itracker/itracker/src/cowsultants/itracker/web/servlets/ApplicationInitialization.java,v retrieving revision 1.31.4.2 retrieving revision 1.31.4.3 diff -C2 -d -r1.31.4.2 -r1.31.4.3 *** ApplicationInitialization.java 13 Oct 2005 14:59:57 -0000 1.31.4.2 --- ApplicationInitialization.java 18 Oct 2005 20:38:48 -0000 1.31.4.3 *************** *** 83,87 **** Logger.logInfo("Checking and initializing languages in the database."); ! SystemConfigurationUtilities.initializeAllLanguages(sc, false); Logger.logInfo("Checking and initializing default system configuration in the database."); --- 83,88 ---- Logger.logInfo("Checking and initializing languages in the database."); ! //SystemConfigurationUtilities.initializeAllLanguages(sc, false); ! SystemConfigurationUtilities.initializeAllLanguages(sc, true); // TMP CHANGE BY RJST Logger.logInfo("Checking and initializing default system configuration in the database."); |
From: Marky G. <mar...@us...> - 2005-10-18 18:12:49
|
Update of /cvsroot/itracker/itracker In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18958 Modified Files: Tag: itrackerhibernate build.xml Log Message: sorry, I inserted the ${war.file} again... Index: build.xml =================================================================== RCS file: /cvsroot/itracker/itracker/build.xml,v retrieving revision 1.73.4.5 retrieving revision 1.73.4.6 diff -C2 -d -r1.73.4.5 -r1.73.4.6 *** build.xml 18 Oct 2005 17:28:46 -0000 1.73.4.5 --- build.xml 18 Oct 2005 18:12:40 -0000 1.73.4.6 *************** *** 19,23 **** <property name="war.file" value="itracker.war" /> <!-- override this in user.build.properties --> ! <property name="install.dir" value="C:/Program Files/jboss-4.0.3/server/default/deploy"/> <!-- ============================================================ --- 19,23 ---- <property name="war.file" value="itracker.war" /> <!-- override this in user.build.properties --> ! <property name="install.dir" value="C:/jboss-4.0.3/server/default/deploy"/> <!-- ============================================================ *************** *** 182,186 **** <target name="deployUnpacked" depends="makeWAR" description="Deploy unpacked project WAR"> ! <unwar src="${dist.dir}/${war.file}" dest="${install.dir}/" overwrite="true"/> </target> --- 182,186 ---- <target name="deployUnpacked" depends="makeWAR" description="Deploy unpacked project WAR"> ! <unwar src="${dist.dir}/${war.file}" dest="${install.dir}/${war.file}" overwrite="true"/> </target> |
From: Marky G. <mar...@us...> - 2005-10-18 17:29:24
|
Update of /cvsroot/itracker/itracker In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8449 Modified Files: Tag: itrackerhibernate build.xml Log Message: fixed the copy line that copies the files to a directory (and not to a file, which did not work). test deployUnpacked. Index: build.xml =================================================================== RCS file: /cvsroot/itracker/itracker/build.xml,v retrieving revision 1.73.4.4 retrieving revision 1.73.4.5 diff -C2 -d -r1.73.4.4 -r1.73.4.5 *** build.xml 18 Oct 2005 00:37:52 -0000 1.73.4.4 --- build.xml 18 Oct 2005 17:28:46 -0000 1.73.4.5 *************** *** 19,23 **** <property name="war.file" value="itracker.war" /> <!-- override this in user.build.properties --> ! <property name="install.dir" value="c:/jboss-4.0.3RC2/server/default/deploy"/> <!-- ============================================================ --- 19,23 ---- <property name="war.file" value="itracker.war" /> <!-- override this in user.build.properties --> ! <property name="install.dir" value="C:/Program Files/jboss-4.0.3/server/default/deploy"/> <!-- ============================================================ *************** *** 182,186 **** <target name="deployUnpacked" depends="makeWAR" description="Deploy unpacked project WAR"> ! <unwar src="${dist.dir}/${war.file}" dest="${install.dir}/${war.file}" overwrite="true"/> </target> --- 182,186 ---- <target name="deployUnpacked" depends="makeWAR" description="Deploy unpacked project WAR"> ! <unwar src="${dist.dir}/${war.file}" dest="${install.dir}/" overwrite="true"/> </target> |
From: Marky G. <mar...@us...> - 2005-10-18 12:02:05
|
Update of /cvsroot/itracker/itracker/src/cowsultants/itracker/ejb/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19186/src/cowsultants/itracker/ejb/test Modified Files: Tag: itrackerhibernate TestApplicationProperties.java Log Message: Removed an error from an ejb test... do we still need this stuff? Index: TestApplicationProperties.java =================================================================== RCS file: /cvsroot/itracker/itracker/src/cowsultants/itracker/ejb/test/TestApplicationProperties.java,v retrieving revision 1.8.4.1 retrieving revision 1.8.4.2 diff -C2 -d -r1.8.4.1 -r1.8.4.2 *** TestApplicationProperties.java 11 Oct 2005 01:21:04 -0000 1.8.4.1 --- TestApplicationProperties.java 18 Oct 2005 12:01:53 -0000 1.8.4.2 *************** *** 21,25 **** import java.util.Properties; - import javax.naming.InitialContext; import javax.naming.NamingException; --- 21,24 ---- *************** *** 36,51 **** } ! public void testGetProperties() { ! try { ! InitialContext ic = new InitialContext(); ! Object scRef = ic.lookup(SystemConfiguration.JNDI_NAME); ! SystemConfiguration sc = new SystemConfigurationBean(); ! ! Properties props = sc.getProperties(); ! assertTrue("default_ds != java:/ITrackerDS", props.getProperty("default_ds").equals("java:/ITrackerDS")); ! } catch(NamingException ne) { ! fail("NamingException caught during testIDCacheLoad: " + ne.getMessage()); ! } } --- 35,43 ---- } ! public void testGetProperties() throws NamingException { ! SystemConfiguration sc = new SystemConfigurationBean(); ! Properties props = sc.getProperties(); ! assertTrue("default_ds != java:/ITrackerDS", props.getProperty("default_ds").equals("java:/ITrackerDS")); } |
From: Ricardo T. <rj...@us...> - 2005-10-18 00:38:01
|
Update of /cvsroot/itracker/itracker In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10201 Modified Files: Tag: itrackerhibernate build.xml Log Message: cleaner build file (contrib by steve jakob) Index: build.xml =================================================================== RCS file: /cvsroot/itracker/itracker/build.xml,v retrieving revision 1.73.4.3 retrieving revision 1.73.4.4 diff -C2 -d -r1.73.4.3 -r1.73.4.4 *** build.xml 13 Oct 2005 12:54:52 -0000 1.73.4.3 --- build.xml 18 Oct 2005 00:37:52 -0000 1.73.4.4 *************** *** 7,32 **** <!-- user defined properties --> <property file="${user.home}/build.properties" /> <property file="build.properties" /> - <!-- properties not set by user definition --> - <property name="code.path" value=".." /> - <property name="project.path.lib" value="lib" /> - <!-- project paths --> ! <property name="project.path.src" value="${basedir}/src/" /> ! <property name="project.path.classes" value="${basedir}/web/WEB-INF/classes" /> ! ! <!-- libraries --> ! ! <!-- DO NOT EDIT BEYOND THIS POINT --> ! ! <!-- ============================================================ ! ! code configuration ! ! ============================================================== --> - <!-- the name of the jar with application code and libraries --> <property name="war.file" value="itracker.war" /> ! <property name="installdir" value="c:/jboss-4.0.3RC2/server/default/deploy"/> <!-- ============================================================ --- 7,23 ---- <!-- user defined properties --> <property file="${user.home}/build.properties" /> + <property file="user.build.properties" /> + <!-- Default Project properties --> <property file="build.properties" /> <!-- project paths --> ! <property name="src.dir" value="${basedir}/src/" /> ! <property name="lib.dir" value="${basedir}/lib" /> ! <property name="build.dir" value="${basedir}/build" /> ! <property name="dist.dir" value="${basedir}/dist" /> ! <property name="war-files.dir" value="${basedir}/web"/> <property name="war.file" value="itracker.war" /> ! <!-- override this in user.build.properties --> ! <property name="install.dir" value="c:/jboss-4.0.3RC2/server/default/deploy"/> <!-- ============================================================ *************** *** 37,46 **** <!-- j2ee --> ! <fileset id="j2ee.library" dir="${project.path.lib}"> <include name="j2ee.jar" /> </fileset> <!-- spring --> ! <fileset id="spring.library" dir="${project.path.lib}"> <include name="spring.jar" /> <include name="aopalliance.jar" /> --- 28,37 ---- <!-- j2ee --> ! <fileset id="j2ee.library" dir="${lib.dir}"> <include name="j2ee.jar" /> </fileset> <!-- spring --> ! <fileset id="spring.library" dir="${lib.dir}"> <include name="spring.jar" /> <include name="aopalliance.jar" /> *************** *** 48,52 **** <!-- hibernate --> ! <fileset id="hibernate.library" dir="${project.path.lib}"> <include name="hibernate2.jar" /> <include name="commons-dbcp-1.2.1.jar" /> --- 39,43 ---- <!-- hibernate --> ! <fileset id="hibernate.library" dir="${lib.dir}"> <include name="hibernate2.jar" /> <include name="commons-dbcp-1.2.1.jar" /> *************** *** 63,67 **** <!-- struts --> ! <fileset id="struts.library" dir="${project.path.lib}"> <include name="struts.jar" /> <include name="commons-beanutils.jar" /> --- 54,58 ---- <!-- struts --> ! <fileset id="struts.library" dir="${lib.dir}"> <include name="struts.jar" /> <include name="commons-beanutils.jar" /> *************** *** 73,97 **** <!-- oro --> ! <fileset id="oro.library" dir="${project.path.lib}"> <include name="oro-2.0.7.jar" /> </fileset> <!-- log4j --> ! <fileset id="log4j.library" dir="${project.path.lib}"> <include name="log4j-1.2.8.jar" /> </fileset> <!-- bsh --> ! <fileset id="bsh.library" dir="${project.path.lib}"> <include name="bsh-1.3.0.jar" /> </fileset> <!-- junit --> ! <fileset id="junit.library" dir="${project.path.lib}"> <include name="junit.jar" /> </fileset> <!-- jfreereport --> ! <fileset id="jfreereport.library" dir="${project.path.lib}"> <include name="jfreereport-0.8.4_4-all.jar" /> <include name="jcommon-0.9.3.jar" /> --- 64,88 ---- <!-- oro --> ! <fileset id="oro.library" dir="${lib.dir}"> <include name="oro-2.0.7.jar" /> </fileset> <!-- log4j --> ! <fileset id="log4j.library" dir="${lib.dir}"> <include name="log4j-1.2.8.jar" /> </fileset> <!-- bsh --> ! <fileset id="bsh.library" dir="${lib.dir}"> <include name="bsh-1.3.0.jar" /> </fileset> <!-- junit --> ! <fileset id="junit.library" dir="${lib.dir}"> <include name="junit.jar" /> </fileset> <!-- jfreereport --> ! <fileset id="jfreereport.library" dir="${lib.dir}"> <include name="jfreereport-0.8.4_4-all.jar" /> <include name="jcommon-0.9.3.jar" /> *************** *** 100,109 **** <!-- jfreereport --> ! <fileset id="jasperreports.library" dir="${project.path.lib}"> <include name="jasperreports-0.6.4.jar" /> </fileset> <!-- jcifs --> ! <fileset id="jcifs.library" dir="${project.path.lib}"> <include name="jcifs-1.1.9.jar" /> </fileset> --- 91,100 ---- <!-- jfreereport --> ! <fileset id="jasperreports.library" dir="${lib.dir}"> <include name="jasperreports-0.6.4.jar" /> </fileset> <!-- jcifs --> ! <fileset id="jcifs.library" dir="${lib.dir}"> <include name="jcifs-1.1.9.jar" /> </fileset> *************** *** 137,154 **** ============================================================== --> ! <target name="init"> <tstamp /> ! <mkdir dir="${project.path.classes}" /> ! <mkdir dir="dist" /> </target> <!-- compile --> ! <target name="compile" depends="init"> ! <javac destdir="${project.path.classes}" debug="on"> ! <src path="${project.path.src}" /> <classpath refid="compile.classpath" /> </javac> ! <copy todir="${project.path.classes}"> ! <fileset dir="${project.path.src}"> <include name="**/*.xml" /> <include name="**/*.properties" /> --- 128,147 ---- ============================================================== --> ! <target name="init" description="Initializes this project"> <tstamp /> ! <mkdir dir="${build.dir}" /> ! <mkdir dir="${dist.dir}" /> </target> <!-- compile --> ! <target name="compile" depends="init" description="Compile project files"> ! <!-- Compile Java classes --> ! <javac destdir="${build.dir}" debug="on"> ! <src path="${src.dir}" /> <classpath refid="compile.classpath" /> </javac> ! <!-- Copy support files from "src" tree to appropriate build directory --> ! <copy todir="${build.dir}"> ! <fileset dir="${src.dir}"> <include name="**/*.xml" /> <include name="**/*.properties" /> *************** *** 158,164 **** <!-- removes all output from the build process --> ! <target name="clean"> ! <delete dir="${project.path.classes}" /> ! <delete dir="dist" /> </target> --- 151,157 ---- <!-- removes all output from the build process --> ! <target name="clean" description="Clean project directory"> ! <delete dir="${build.dir}" /> ! <delete dir="${dist.dir}" /> </target> *************** *** 169,174 **** ============================================================== --> ! <target name="makeWAR" depends="compile"> ! <war destfile="dist/${war.file}" basedir="web" webxml="${basedir}/web/WEB-INF/web.xml"> <lib refid="hibernate.library" /> <lib refid="spring.library" /> --- 162,168 ---- ============================================================== --> ! <target name="makeWAR" depends="compile" description="Create project WAR"> ! <war destfile="${dist.dir}/${war.file}" basedir="${war-files.dir}" ! webxml="${war-files.dir}/WEB-INF/web.xml"> <lib refid="hibernate.library" /> <lib refid="spring.library" /> *************** *** 178,198 **** <lib refid="jfreereport.library" /> <lib refid="jasperreports.library" /> ! <lib refid="jcifs.library" /> </war> </target> ! <target name="deploy" depends="makeWAR"> ! <copy todir="${installdir}" file="dist/${war.file}" overwrite="true"/> </target> ! <target name="deployUnpacked" depends="makeWAR"> ! <unwar src="dist/${war.file}" dest="${installdir}/${war.file}" overwrite="true"/> </target> ! <target name="copyClassesAndRedeploy" depends="init"> ! <copy todir="${installdir}/${war.file}/WEB-INF/classes" overwrite="true"> ! <fileset dir="web/WEB-INF/classes/"/> </copy> ! <touch file="${installdir}/${war.file}/WEB-INF/web.xml"/> </target> --- 172,193 ---- <lib refid="jfreereport.library" /> <lib refid="jasperreports.library" /> ! <lib refid="jcifs.library" /> ! <classes dir="${build.dir}" /> </war> </target> ! <target name="deploy" depends="makeWAR" description="Deploy project WAR"> ! <copy todir="${install.dir}" file="${dist.dir}/${war.file}" overwrite="true"/> </target> ! <target name="deployUnpacked" depends="makeWAR" description="Deploy unpacked project WAR"> ! <unwar src="${dist.dir}/${war.file}" dest="${install.dir}/${war.file}" overwrite="true"/> </target> ! <target name="copyClassesAndRedeploy" depends="init" description="Redeploy WAR classes only"> ! <copy todir="${install.dir}/${war.file}/WEB-INF/classes" overwrite="true"> ! <fileset dir="${build.dir}"/> </copy> ! <touch file="${install.dir}/${war.file}/WEB-INF/web.xml"/> </target> |
From: Ricardo T. <rj...@us...> - 2005-10-18 00:13:21
|
Update of /cvsroot/itracker/itracker/web/includes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5453/includes Modified Files: Tag: itrackerhibernate header.jsp header_minimal.jsp Log Message: removed ejb references Index: header_minimal.jsp =================================================================== RCS file: /cvsroot/itracker/itracker/web/includes/header_minimal.jsp,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** header_minimal.jsp 22 Aug 2005 11:41:30 -0000 1.1 --- header_minimal.jsp 18 Oct 2005 00:13:13 -0000 1.1.4.1 *************** *** 3,7 **** <%@ page import="java.text.*" %> <%@ page import="java.util.*" %> - <%@ page import="javax.ejb.*" %> <%@ page import="javax.naming.*" %> <%@ page import="javax.rmi.*" %> --- 3,6 ---- Index: header.jsp =================================================================== RCS file: /cvsroot/itracker/itracker/web/includes/header.jsp,v retrieving revision 1.26.4.2 retrieving revision 1.26.4.3 diff -C2 -d -r1.26.4.2 -r1.26.4.3 *** header.jsp 13 Oct 2005 15:02:48 -0000 1.26.4.2 --- header.jsp 18 Oct 2005 00:13:13 -0000 1.26.4.3 *************** *** 3,7 **** <%@ page import="java.text.*" %> <%@ page import="java.util.*" %> - <%@ page import="javax.ejb.*" %> <%@ page import="javax.naming.*" %> <%@ page import="javax.rmi.*" %> --- 3,6 ---- |
From: Ricardo T. <rj...@us...> - 2005-10-18 00:13:21
|
Update of /cvsroot/itracker/itracker/web/help In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5453/help Modified Files: Tag: itrackerhibernate help_about.jsp Log Message: removed ejb references Index: help_about.jsp =================================================================== RCS file: /cvsroot/itracker/itracker/web/help/help_about.jsp,v retrieving revision 1.17 retrieving revision 1.17.4.1 diff -C2 -d -r1.17 -r1.17.4.1 *** help_about.jsp 22 Aug 2005 11:41:30 -0000 1.17 --- help_about.jsp 18 Oct 2005 00:13:13 -0000 1.17.4.1 *************** *** 10,14 **** <%@ page import="javax.naming.*" %> <%@ page import="javax.rmi.*" %> - <%@ page import="javax.ejb.*" %> <%@ page import="cowsultants.itracker.ejb.client.interfaces.*" %> <%@ page import="cowsultants.itracker.ejb.client.util.*" %> --- 10,13 ---- |