View Javadoc

1   /*
2    * Copyright 2004-2005 OSOCO.org (Carsten Ziegeler)
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.osoco.cowarp.impl;
17  
18  import java.io.Serializable;
19  
20  import org.osoco.cowarp.User;
21  
22  /***
23   * This class keeps track of the number of applications a user is logged into
24   * using the same security handler.
25   *
26   * @author <a href="mailto:cziegeler.at.osoco.org">Carsten Ziegeler</a>
27   * @version CVS $Id: LoginInfo.java,v 1.5 2005/02/21 09:28:29 cziegeler Exp $
28  */
29  public class LoginInfo 
30  implements Serializable {
31  
32      protected int   counter;
33      protected final User user;
34      
35      public LoginInfo(final User user) {
36          this.user = user;
37      }
38  
39      public void incUsageCounter() {
40          this.counter++;
41      }
42  
43      public void decUsageCounter() {
44          this.counter--;
45      }
46  
47      public boolean isUsed() {
48          return (this.counter > 0);
49      }
50  
51      public User getUser() {
52          return this.user;
53      }
54  }