Return-Path: Delivered-To: apmail-chemistry-commits-archive@www.apache.org Received: (qmail 51165 invoked from network); 22 Feb 2011 09:12:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 22 Feb 2011 09:12:02 -0000 Received: (qmail 33421 invoked by uid 500); 22 Feb 2011 09:12:02 -0000 Delivered-To: apmail-chemistry-commits-archive@chemistry.apache.org Received: (qmail 33352 invoked by uid 500); 22 Feb 2011 09:11:59 -0000 Mailing-List: contact commits-help@chemistry.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@chemistry.apache.org Delivered-To: mailing list commits@chemistry.apache.org Received: (qmail 33327 invoked by uid 99); 22 Feb 2011 09:11:58 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Feb 2011 09:11:58 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Feb 2011 09:11:55 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 19E1B2388A6C; Tue, 22 Feb 2011 09:11:34 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r785929 [2/6] - in /websites/production/chemistry: ./ content/ content/data/ content/dotnet/ content/images/ content/java/ content/php/ content/python/ content/resources/ Date: Tue, 22 Feb 2011 09:11:34 -0000 To: commits@chemistry.apache.org From: fmui@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110222091135.19E1B2388A6C@eris.apache.org> Modified: websites/production/chemistry/content/getting-started-with-dotcmis.html ============================================================================== --- websites/production/chemistry/content/getting-started-with-dotcmis.html (original) +++ websites/production/chemistry/content/getting-started-with-dotcmis.html Tue Feb 22 09:11:32 2011 @@ -15,13 +15,14 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + --> - - + + - + Apache Chemistry - Getting started with DotCMIS @@ -42,9 +43,14 @@ Apache Chemistry - Getting started with +
- - - + + + + + + +
@@ -64,7 +70,13 @@ Apache Chemistry - Getting started with @@ -164,44 +176,30 @@ Apache Chemistry - Getting started with

Connecting to a CMIS AtomPub endpoint

Connecting to the first repository

-
Dictionary<string, string> parameters = new Dictionary<string, string>();
-
-parameters[SessionParameter.BindingType]
-
+
Dictionary<string, string> parameters = new Dictionary<string, string>();
 
+parameters[SessionParameter.BindingType] = BindingType.AtomPub;
+parameters[SessionParameter.AtomPubUrl] = "http://<host>/<serviceDocumentPath>";
+parameters[SessionParameter.User] = "<username>";
+parameters[SessionParameter.Password] = "<password>";
 
-

= BindingType.AtomPub; - parameters[SessionParameter.AtomPubUrl] - = "http:///"; - parameters[SessionParameter.User] - = ""; - parameters[SessionParameter.Password] - = "";

-
SessionFactory factory = SessionFactory.NewInstance();
-ISession session = factory.GetRepositories(parameters)[0]
+SessionFactory factory = SessionFactory.NewInstance();
+ISession session = factory.GetRepositories(parameters)[0].CreateSession();
 
-

.CreateSession();

Connecting to a specific repository

-
Dictionary<string, string> parameters = new Dictionary<string, string>();
-
-parameters[SessionParameter.BindingType]
-
+
Dictionary<string, string> parameters = new Dictionary<string, string>();
 
+parameters[SessionParameter.BindingType] = BindingType.AtomPub;
+parameters[SessionParameter.AtomPubUrl] = "http://<host>/<serviceDocumentPath>";
+parameters[SessionParameter.User] = "<username>";
+parameters[SessionParameter.Password] = "<password>";
+parameters[SessionParameter.RepositoryId] = "<repositoryId>";
 
-

= BindingType.AtomPub; - parameters[SessionParameter.AtomPubUrl] - = "http:///"; - parameters[SessionParameter.User] - = ""; - parameters[SessionParameter.Password] - = ""; - parameters[SessionParameter.RepositoryId] - = "";

-
SessionFactory factory = SessionFactory.NewInstance();
-ISession session = factory.CreateSession(parameters);
+SessionFactory factory = SessionFactory.NewInstance();
+ISession session = factory.CreateSession(parameters);
 
@@ -209,209 +207,155 @@ Apache Chemistry - Getting started with

Connecting to a CMIS Web Services endpoint

Connecting to the first repository

-
Dictionary<string, string> parameters = new Dictionary<string, string>();
-
-parameters[SessionParameter.BindingType]
-
+
Dictionary<string, string> parameters = new Dictionary<string, string>();
 
+parameters[SessionParameter.BindingType] = BindingType.WebServices;
+parameters[SessionParameter.WebServicesRepositoryService] = "http://<host>/<RepositoryServiceWSDL>";
+parameters[SessionParameter.WebServicesAclService] = "http://<host>/<AclServiceWSDL>";
+parameters[SessionParameter.WebServicesDiscoveryService] = "http://<host>/<DiscoveryServiceWSDL>";
+parameters[SessionParameter.WebServicesMultifilingService] = "http://<host>/<MultifilingServiceWSDL>";
+parameters[SessionParameter.WebServicesNavigationService] = "http://<host>/<NavigationServiceWSDL>";
+parameters[SessionParameter.WebServicesObjectService] = "http://<host>/<ObjectServiceWSDL>";
+parameters[SessionParameter.WebServicesPolicyService] = "http://<host>/<PolicyServiceWSDL>";
+parameters[SessionParameter.WebServicesRelationshipService] = "http://<host>/<RelationshipServiceWSDL>";
+parameters[SessionParameter.WebServicesVersioningService] = "http://<host>/<VersioningServiceWSDL>";
+parameters[SessionParameter.User] = "<username>";
+parameters[SessionParameter.Password] = "<password>";
 
-

= BindingType.WebServices; - parameters[SessionParameter.WebServicesRepositoryService] - = "http:///"; - parameters[SessionParameter.WebServicesAclService] - = "http:///"; - parameters[SessionParameter.WebServicesDiscoveryService] - = "http:///"; - parameters[SessionParameter.WebServicesMultifilingService] - = "http:///"; - parameters[SessionParameter.WebServicesNavigationService] - = "http:///"; - parameters[SessionParameter.WebServicesObjectService] - = "http:///"; - parameters[SessionParameter.WebServicesPolicyService] - = "http:///"; - parameters[SessionParameter.WebServicesRelationshipService] - = "http:///"; - parameters[SessionParameter.WebServicesVersioningService] - = "http:///"; - parameters[SessionParameter.User] - = ""; - parameters[SessionParameter.Password] - = "";

-
SessionFactory factory = SessionFactory.NewInstance();
-ISession session = factory.GetRepositories(parameters)[0]
+SessionFactory factory = SessionFactory.NewInstance();
+ISession session = factory.GetRepositories(parameters)[0].CreateSession();
 
-

.CreateSession();

Connecting to a specific repository

-
Dictionary<string, string> parameters = new Dictionary<string, string>();
-
-parameters[SessionParameter.BindingType]
-
+
Dictionary<string, string> parameters = new Dictionary<string, string>();
 
+parameters[SessionParameter.BindingType] = BindingType.WebServices;
+parameters[SessionParameter.WebServicesRepositoryService] = "http://<host>/<RepositoryServiceWSDL>";
+parameters[SessionParameter.WebServicesAclService] = "http://<host>/<AclServiceWSDL>";
+parameters[SessionParameter.WebServicesDiscoveryService] = "http://<host>/<DiscoveryServiceWSDL>";
+parameters[SessionParameter.WebServicesMultifilingService] = "http://<host>/<MultifilingServiceWSDL>";
+parameters[SessionParameter.WebServicesNavigationService] = "http://<host>/<NavigationServiceWSDL>";
+parameters[SessionParameter.WebServicesObjectService] = "http://<host>/<ObjectServiceWSDL>";
+parameters[SessionParameter.WebServicesPolicyService] = "http://<host>/<PolicyServiceWSDL>";
+parameters[SessionParameter.WebServicesRelationshipService] = "http://<host>/<RelationshipServiceWSDL>";
+parameters[SessionParameter.WebServicesVersioningService] = "http://<host>/<VersioningServiceWSDL>";
+parameters[SessionParameter.User] = "<username>";
+parameters[SessionParameter.Password] = "<password>";
+parameters[SessionParameter.RepositoryId] = "<repositoryId>";
 
-

= BindingType.WebServices; - parameters[SessionParameter.WebServicesRepositoryService] - = "http:///"; - parameters[SessionParameter.WebServicesAclService] - = "http:///"; - parameters[SessionParameter.WebServicesDiscoveryService] - = "http:///"; - parameters[SessionParameter.WebServicesMultifilingService] - = "http:///"; - parameters[SessionParameter.WebServicesNavigationService] - = "http:///"; - parameters[SessionParameter.WebServicesObjectService] - = "http:///"; - parameters[SessionParameter.WebServicesPolicyService] - = "http:///"; - parameters[SessionParameter.WebServicesRelationshipService] - = "http:///"; - parameters[SessionParameter.WebServicesVersioningService] - = "http:///"; - parameters[SessionParameter.User] - = ""; - parameters[SessionParameter.Password] - = ""; - parameters[SessionParameter.RepositoryId] - = "";

-
SessionFactory factory = SessionFactory.NewInstance();
-ISession session = factory.CreateSession(parameters);
+SessionFactory factory = SessionFactory.NewInstance();
+ISession session = factory.CreateSession(parameters);
 

Listing folder children

-
/// get the root folder
-IFolder rootFolder = session.GetRootFolder();
+
/// get the root folder
+IFolder rootFolder = session.GetRootFolder();
 
-// list all children
-foreach (ICmisObject cmisObject in rootFolder.GetChildren())
+// list all children
+foreach (ICmisObject cmisObject in rootFolder.GetChildren())
 {
-    Console.WriteLine(cmisObject.Name);
+    Console.WriteLine(cmisObject.Name);
 }
 
-// get a page
-IItemEnumerable<ICmisObject> children = rootFolder.GetChildren();
-IItemEnumerable<ICmisObject> page = children.SkipTo(20).GetPage(10); //
-
- +// get a page +IItemEnumerable<ICmisObject> children = rootFolder.GetChildren(); +IItemEnumerable<ICmisObject> page = children.SkipTo(20).GetPage(10); // children 20 to 30 -

children 20 to 30

-
foreach (ICmisObject cmisObject in page)
+foreach (ICmisObject cmisObject in page)
 {
-    Console.WriteLine(cmisObject.Name);
+    Console.WriteLine(cmisObject.Name);
 }
 

Fetching a document

-
IObjectId id = session.CreateObjectId("12345678");
-IDocument doc = session.GetObject(id) as IDocument;
-
-// properties
-Console.WriteLine(doc.Name);
-Console.WriteLine(doc.GetPropertyValue("my:property"));
-
-IProperty myProperty = doc["my:property"]
-
+
IObjectId id = session.CreateObjectId("12345678");
+IDocument doc = session.GetObject(id) as IDocument;
 
-
-

; - Console.WriteLine("Id: " + myProperty.Id); - Console.WriteLine("Value: " + myProperty.Value); - Console.WriteLine("Type: " + myProperty.PropertyType);

-
// content
-IContentStream contentStream = doc.GetContentStream();
-Console.WriteLine("Filename:   " + contentStream.FileName);
-Console.WriteLine("MIME type:  " + contentStream.MimeType);
-Console.WriteLine("Has stream: " + (contentStream.Stream != null));
+// properties
+Console.WriteLine(doc.Name);
+Console.WriteLine(doc.GetPropertyValue("my:property"));
+
+IProperty myProperty = doc["my:property"];
+Console.WriteLine("Id:    " + myProperty.Id);
+Console.WriteLine("Value: " + myProperty.Value);
+Console.WriteLine("Type:  " + myProperty.PropertyType);
+
+// content
+IContentStream contentStream = doc.GetContentStream();
+Console.WriteLine("Filename:   " + contentStream.FileName);
+Console.WriteLine("MIME type:  " + contentStream.MimeType);
+Console.WriteLine("Has stream: " + (contentStream.Stream != null));
 

Creating a document

-
IFolder folder = ...
-
-IDictionary<string, object> properties = new Dictionary<string, object>();
-properties[PropertyIds.Name]
-
- +
IFolder folder = ...
 
-

= "Hello World Document"; - properties[PropertyIds.ObjectTypeId] - = "cmis:document";

-
byte[]
-
+IDictionary<string, object> properties = new Dictionary<string, object>(); +properties[PropertyIds.Name] = "Hello World Document"; +properties[PropertyIds.ObjectTypeId] = "cmis:document"; +byte[] content = UTF8Encoding.UTF8.GetBytes("Hello World!"); -

content = UTF8Encoding.UTF8.GetBytes("Hello World!");

-
ContentStream contentStream = new ContentStream();
-contentStream.FileName = "hello-world.txt";
-contentStream.MimeType = "text/plain";
-contentStream.Length = content.Length;
-contentStream.Stream = new MemoryStream(content);
+ContentStream contentStream = new ContentStream();
+contentStream.FileName = "hello-world.txt";
+contentStream.MimeType = "text/plain";
+contentStream.Length = content.Length;
+contentStream.Stream = new MemoryStream(content);
 
-IDocument doc = folder.CreateDocument(properties, contentStream, null);
+IDocument doc = folder.CreateDocument(properties, contentStream, null);
 

Updating properties

-
ICmisObject cmisObject = ...
-
-IDictionary<string, object> properties = new Dictionary<string, object>();
-properties["my:string"]
-
+
ICmisObject cmisObject = ...
 
+IDictionary<string, object> properties = new Dictionary<string, object>();
+properties["my:string"] = "a string";
+properties["my:int"] = 42;
+properties["my:date"] = DateTime.Now;
 
-

= "a string"; - properties["my:int"] - = 42; - properties["my:date"] - = DateTime.Now;

-
IObjectId newId = cmisObject.UpdateProperties(properties);
+IObjectId newId = cmisObject.UpdateProperties(properties);
 
-if (newId.Id == cmisObject.Id) 
+if (newId.Id == cmisObject.Id) 
 {
-    // the repository updated this object - refresh the object
-    cmisObject.Refresh();
+    // the repository updated this object - refresh the object
+    cmisObject.Refresh();
 }
 else
 {
-    // the repository created a new version - fetch the new version
-    cmisObject = session.GetObject(newId);
+    // the repository created a new version - fetch the new version
+    cmisObject = session.GetObject(newId);
 }
 

Deleting an object

-
IObjectId newId = session.CreateObjectId("12345678"):
-ICmisObject cmisObject = session.GetObject(newId);
+
IObjectId newId = session.CreateObjectId("12345678"):
+ICmisObject cmisObject = session.GetObject(newId);
 
-cmisObject.Delete(true);
+cmisObject.Delete(true);
 

Performing a query

-
IItemEnumerable<IQueryResult> qr = session.Query("SELECT * FROM
-
+
IItemEnumerable<IQueryResult> qr = session.Query("SELECT * FROM cmis:document", false);
 
-
-

cmis:document", false);

-
foreach (IQueryResult hit in qr)
+foreach (IQueryResult hit in qr)
 {
-    Console.WriteLine(hit["cmis:name"]
-
- - -

.FirstValue + " (" + hit["cmis:objectId"].FirstValue + ")"); - }

+ Console.WriteLine(hit["cmis:name"].FirstValue + " (" + hit["cmis:objectId"].FirstValue + ")"); +} +
@@ -420,6 +364,11 @@ Apache Chemistry - Getting started with   +   +   +   + +