Module: CMIS

Defined in:
lib/cmis/enums.rb,
lib/cmis/imports.rb,
lib/cmis/version.rb,
lib/cmis/object_impl.rb,
lib/cmis/content_helpers.rb,
lib/cmis/session_helpers.rb

Defined Under Namespace

Classes: DocumentImpl, FolderImpl

Constant Summary collapse

VERSION =
"0.4.0"

Class Method Summary collapse

Class Method Details

.create_content_stream(filename, session) ⇒ Object



2
3
4
5
6
7
8
9
# File 'lib/cmis/content_helpers.rb', line 2

def self.create_content_stream(filename, session)
  file = java.io.File.new(filename)
  file_input_stream = java.io.FileInputStream.new(file)
  stream = java.io.BufferedInputStream.new(file_input_stream)
  content = session.object_factory.create_content_stream(file.name, file.length, MimeTypes.getMIMEType(file), stream)
  
  content
end

.create_session(url, user, password, repo_id = nil) ⇒ Object



2
3
4
5
6
7
8
# File 'lib/cmis/session_helpers.rb', line 2

def self.create_session(url, user, password, repo_id = nil)
  session_factory = SessionFactoryImpl.new_instance
  params = session_params(url, user, password)
  repo_id = self.repositories(url, user, password)[0].id if repo_id == nil
  params[SessionParameter::REPOSITORY_ID] = repo_id
  session_factory.create_session(java.util.HashMap.new(params))
end

.repositories(url, user, password) ⇒ Object



10
11
12
13
14
# File 'lib/cmis/session_helpers.rb', line 10

def self.repositories(url, user, password)
  session_factory = SessionFactoryImpl.new_instance
  params = session_params(url, user, password)
  session_factory.get_repositories(java.util.HashMap.new(params))
end