This project has retired. For details please refer to its Attic page.
SessionFactory xref

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   * http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.chemistry.opencmis.client.api;
20  
21  import java.util.List;
22  import java.util.Map;
23  
24  import org.apache.chemistry.opencmis.commons.SessionParameter;
25  import org.apache.chemistry.opencmis.commons.exceptions.CmisBaseException;
26  
27  /**
28   * Entry point into the OpenCMIS Client API. The <code>SessionFactory</code>
29   * class implementation needs to be retrieved by any runtime lookup call. This
30   * can for instance be a J2EE JNDI lookup or an OSGi service lookup.
31   * <p>
32   * The entries of the parameter map are defined by <code>SessionParameter</code>
33   * class which is part of the commons package. Parameters specify connection
34   * settings (user name, authentication, connection url, binding type (soap or
35   * atom pub) ...).
36   * <p>
37   * The <code>Session</code> class which is constructed is either the
38   * <code>session</code> base class which is the default implementation or it can
39   * be derived from that implementing special behavior for the session.
40   * <p>
41   * Sample code:
42   * <p>
43   * <code>
44   * SessionFactory factory = ... // use a runtime lookup service
45   * <br>
46   * <br>Map<String, String> parameter = ...
47   * <br>parameter.put(SessionParameter.USER, "Otto");
48   * <br>parameter.put(SessionParameter.PASSWORD, "****");
49   * <br>
50   * <br>parameter.put(SessionParameter.ATOMPUB_URL, "http://localhost/cmis/atom");
51   * <br>parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
52   * <br>parameter.put(SessionParameter.REPOSITORY_ID, "myRepository");
53   * <br>...
54   * <br>Session session = factory.createSession(parameter);
55   * </code>
56   */
57  public interface SessionFactory {
58  
59      /**
60       * Creates a new session.
61       * 
62       * @param parameters
63       *            a {@code Map} of name/value pairs with parameters for the
64       *            session
65       * @return a {@link Session} connected to the CMIS repository
66       * @throws CmisBaseException
67       *             if the connection could not be established
68       * 
69       * @see SessionParameter
70       */
71      Session createSession(Map<String, String> parameters);
72  
73      /**
74       * Returns all repositories that are available at the endpoint. See
75       * {@link #createSession(Map)} for parameter details. The parameter
76       * {@code SessionParameter.REPOSITORY_ID} should not be set.
77       */
78      List<Repository> getRepositories(Map<String, String> parameters);
79  
80  }