コード例 #1
0
  public synchronized Session getSession() {
    if (this.session == null) {
      // default factory implementation of client runtime
      SessionFactory f = SessionFactoryImpl.newInstance();
      Map<String, String> parameter = new HashMap<String, String>();

      // user credentials
      parameter.put(SessionParameter.USER, "admin");
      parameter.put(SessionParameter.PASSWORD, "admin");

      // connection settings
      parameter.put(
          SessionParameter.ATOMPUB_URL,
          "http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/atom");
      parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());

      // session locale
      parameter.put(SessionParameter.LOCALE_ISO3166_COUNTRY, "");
      parameter.put(SessionParameter.LOCALE_ISO639_LANGUAGE, "de");

      // create session
      parameter.put(SessionParameter.REPOSITORY_ID, "-default-");
      this.session = f.createSession(parameter);
    }

    return this.session;
  }
コード例 #2
0
 protected Session createSession(Map<String, String> parameters) {
   if (parameters.containsKey(SessionParameter.REPOSITORY_ID)) {
     return sessionFactory.createSession(new HashMap<String, String>(parameters));
   } else {
     return sessionFactory
         .getRepositories(new HashMap<String, String>(parameters))
         .get(0)
         .createSession();
   }
 }
コード例 #3
0
  public List<Repository> getRepositories(CMISServer server) {
    if (server == null) {
      throw new IllegalArgumentException("Server must be set!");
    }

    return sessionFactory.getRepositories(new HashMap<String, String>(server.getParameters()));
  }