Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: be37a01ff246899e02c305a2a869bc6989bbb0ac (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/***************************************************************************
 * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *    Eike Stepper - initial API and implementation
 **************************************************************************/
package org.eclipse.emf.internal.cdo.protocol;

import org.eclipse.emf.cdo.common.id.CDOIDLibraryDescriptor;
import org.eclipse.emf.cdo.common.id.CDOIDMetaRange;
import org.eclipse.emf.cdo.common.model.CDOPackageInfo;
import org.eclipse.emf.cdo.common.model.CDOPackageURICompressor;

import org.eclipse.net4j.util.io.ExtendedDataInput;
import org.eclipse.net4j.util.io.ExtendedDataOutput;
import org.eclipse.net4j.util.io.StringCompressor;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/**
 * @author Eike Stepper
 */
public final class OpenSessionResult implements CDOPackageURICompressor
{
  private int sessionID;

  private String repositoryUUID;

  private long repositoryCreationTime;

  private RepositoryTimeResult repositoryTimeResult;

  private boolean repositorySupportingAudits;

  private CDOIDLibraryDescriptor libraryDescriptor;

  private List<CDOPackageInfo> packageInfos = new ArrayList<CDOPackageInfo>();

  private StringCompressor compressor = new StringCompressor(true);

  public OpenSessionResult(int sessionID, String repositoryUUID, long repositoryCreationTime,
      boolean repositorySupportingAudits, CDOIDLibraryDescriptor libraryDescriptor)
  {
    this.sessionID = sessionID;
    this.repositoryUUID = repositoryUUID;
    this.repositoryCreationTime = repositoryCreationTime;
    this.repositorySupportingAudits = repositorySupportingAudits;
    this.libraryDescriptor = libraryDescriptor;
  }

  public int getSessionID()
  {
    return sessionID;
  }

  public String getRepositoryUUID()
  {
    return repositoryUUID;
  }

  public long getRepositoryCreationTime()
  {
    return repositoryCreationTime;
  }

  public boolean isRepositorySupportingAudits()
  {
    return repositorySupportingAudits;
  }

  public RepositoryTimeResult getRepositoryTimeResult()
  {
    return repositoryTimeResult;
  }

  public void setRepositoryTimeResult(RepositoryTimeResult repositoryTimeResult)
  {
    this.repositoryTimeResult = repositoryTimeResult;
  }

  public CDOIDLibraryDescriptor getLibraryDescriptor()
  {
    return libraryDescriptor;
  }

  public List<CDOPackageInfo> getPackageInfos()
  {
    return packageInfos;
  }

  void addPackageInfo(String packageURI, boolean dynamic, CDOIDMetaRange metaIDRange, String parentURI)
  {
    packageInfos.add(new CDOPackageInfo(packageURI, dynamic, metaIDRange, parentURI));
  }

  public StringCompressor getCompressor()
  {
    return compressor;
  }

  /**
   * @since 2.0
   */
  public void writePackageURI(ExtendedDataOutput out, String uri) throws IOException
  {
    compressor.write(out, uri);
  }

  /**
   * @since 2.0
   */
  public String readPackageURI(ExtendedDataInput in) throws IOException
  {
    return compressor.read(in);
  }
}

Back to the top