You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by je...@apache.org on 2010/04/16 16:14:02 UTC
svn commit: r934896 [9/12] - in
/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server:
chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/
chemistry-opencmis-server-bindings/src/main/java/org/apache/chemi...
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/ServicesFactory.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/ServicesFactory.java?rev=934896&r1=934895&r2=934896&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/ServicesFactory.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/ServicesFactory.java Fri Apr 16 14:14:00 2010
@@ -54,212 +54,203 @@ import org.apache.commons.logging.LogFac
*/
public class ServicesFactory extends AbstractServicesFactory {
- private static final String PREFIX_LOGIN = "login.";
- private static final String PREFIX_REPOSITORY = "repository.";
- private static final String PREFIX_TYPE = "type.";
- private static final String SUFFIX_READWRITE = ".readwrite";
- private static final String SUFFIX_READONLY = ".readonly";
-
- private static final BigInteger DEFAULT_MAX_ITEMS_OBJECTS = BigInteger.valueOf(200);
- private static final BigInteger DEFAULT_MAX_ITEMS_TYPES = BigInteger.valueOf(50);
- private static final BigInteger DEFAULT_DEPTH_OBJECTS = BigInteger.valueOf(10);
- private static final BigInteger DEFAULT_DEPTH_TYPES = BigInteger.valueOf(-1);
-
- private static final Log log = LogFactory.getLog(AbstractServicesFactory.class);
-
- private RepositoryMap fRepositoryMap;
- private TypeManager fTypeManager;
-
- private CmisRepositoryService fRepositoryService;
- private CmisNavigationService fNavigationService;
- private CmisObjectService fObjectService;
- private CmisVersioningService fVersioningService;
- private CmisAclService fAclService;
-
- public ServicesFactory() {
- }
-
- @Override
- public void init(Map<String, String> parameters) {
- fRepositoryMap = new RepositoryMap();
- fTypeManager = new TypeManager();
-
- readConfiguration(parameters);
-
- // create service object with wrappers
- fRepositoryService = new RepositoryServiceWrapper(new RepositoryService(fRepositoryMap),
- DEFAULT_MAX_ITEMS_TYPES, DEFAULT_DEPTH_TYPES);
- fNavigationService = new NavigationServiceWrapper(new NavigationService(fRepositoryMap),
- DEFAULT_MAX_ITEMS_OBJECTS, DEFAULT_DEPTH_OBJECTS);
- fObjectService = new ObjectServiceWrapper(new ObjectService(fRepositoryMap),
- DEFAULT_MAX_ITEMS_OBJECTS);
- fVersioningService = new VersioningServiceWrapper(new VersioningService(fRepositoryMap));
- fAclService = new AclServiceWrapper(new AclService(fRepositoryMap));
- }
-
- @Override
- public CmisRepositoryService getRepositoryService() {
- return fRepositoryService;
- }
-
- @Override
- public CmisNavigationService getNavigationService() {
- return fNavigationService;
- }
-
- @Override
- public CmisObjectService getObjectService() {
- return fObjectService;
- }
-
- @Override
- public CmisVersioningService getVersioningService() {
- return fVersioningService;
- }
-
- @Override
- public CmisAclService getAclService() {
- return fAclService;
- }
-
- // ---- helpers ----
-
- private void readConfiguration(Map<String, String> parameters) {
- List<String> keys = new ArrayList<String>(parameters.keySet());
- Collections.sort(keys);
-
- for (String key : keys) {
- if (key.startsWith(PREFIX_LOGIN)) {
- // get logins
- String usernameAndPassword = replaceSystemProperties(parameters.get(key));
- if (usernameAndPassword == null) {
- continue;
- }
-
- String username = usernameAndPassword;
- String password = "";
-
- int x = usernameAndPassword.indexOf(':');
- if (x > -1) {
- username = usernameAndPassword.substring(0, x);
- password = usernameAndPassword.substring(x + 1);
- }
-
- fRepositoryMap.addLogin(username, password);
-
- log.info("Added login '" + username + "'.");
- }
- else if (key.startsWith(PREFIX_TYPE)) {
- // load type definition
- TypeDefinition type = loadType(replaceSystemProperties(parameters.get(key)));
- if (type != null) {
- fTypeManager.addType(type);
- }
- }
- else if (key.startsWith(PREFIX_REPOSITORY)) {
- // configure repositories
- String repositoryId = key.substring(PREFIX_REPOSITORY.length()).trim();
- int x = repositoryId.lastIndexOf('.');
- if (x > 0) {
- repositoryId = repositoryId.substring(0, x);
- }
-
- if (repositoryId.length() == 0) {
- throw new IllegalArgumentException("No repository id!");
- }
-
- if (key.endsWith(SUFFIX_READWRITE)) {
- // read-write users
- FileShareRepository fsr = fRepositoryMap.getRepository(repositoryId);
- for (String user : split(parameters.get(key))) {
- fsr.addUser(replaceSystemProperties(user), false);
- }
- }
- else if (key.endsWith(SUFFIX_READONLY)) {
- // read-only users
- FileShareRepository fsr = fRepositoryMap.getRepository(repositoryId);
- for (String user : split(parameters.get(key))) {
- fsr.addUser(replaceSystemProperties(user), true);
- }
- }
- else {
- // new repository
- String root = replaceSystemProperties(parameters.get(key));
- FileShareRepository fsr = new FileShareRepository(repositoryId, root, fTypeManager);
-
- fRepositoryMap.addRepository(fsr);
-
- log.info("Added repository '" + fsr.getRepositoryId() + "': " + root);
- }
- }
- }
- }
-
- private List<String> split(String csl) {
- if (csl == null) {
- return Collections.emptyList();
- }
-
- List<String> result = new ArrayList<String>();
- for (String s : csl.split(",")) {
- result.add(s.trim());
- }
-
- return result;
- }
-
- private String replaceSystemProperties(String s) {
- if (s == null) {
- return null;
- }
-
- StringBuilder result = new StringBuilder();
- StringBuilder property = null;
- boolean inProperty = false;
-
- for (int i = 0; i < s.length(); i++) {
- char c = s.charAt(i);
-
- if (inProperty) {
- if (c == '}') {
- String value = System.getProperty(property.toString());
- if (value != null) {
- result.append(value);
- }
- inProperty = false;
- }
- else {
- property.append(c);
- }
- }
- else {
- if (c == '{') {
- property = new StringBuilder();
- inProperty = true;
- }
- else {
- result.append(c);
- }
- }
- }
-
- return result.toString();
- }
-
- @SuppressWarnings("unchecked")
- private TypeDefinition loadType(String filename) {
- TypeDefinition result = null;
-
- try {
- Unmarshaller u = JaxBHelper.createUnmarshaller();
- JAXBElement<CmisTypeDefinitionType> type = (JAXBElement<CmisTypeDefinitionType>) u
- .unmarshal(new File(filename));
- result = Converter.convert(type.getValue());
- }
- catch (Exception e) {
- log.info("Could not load type: '" + filename + "'", e);
- }
+ private static final String PREFIX_LOGIN = "login.";
+ private static final String PREFIX_REPOSITORY = "repository.";
+ private static final String PREFIX_TYPE = "type.";
+ private static final String SUFFIX_READWRITE = ".readwrite";
+ private static final String SUFFIX_READONLY = ".readonly";
+
+ private static final BigInteger DEFAULT_MAX_ITEMS_OBJECTS = BigInteger.valueOf(200);
+ private static final BigInteger DEFAULT_MAX_ITEMS_TYPES = BigInteger.valueOf(50);
+ private static final BigInteger DEFAULT_DEPTH_OBJECTS = BigInteger.valueOf(10);
+ private static final BigInteger DEFAULT_DEPTH_TYPES = BigInteger.valueOf(-1);
+
+ private static final Log log = LogFactory.getLog(AbstractServicesFactory.class);
+
+ private RepositoryMap fRepositoryMap;
+ private TypeManager fTypeManager;
+
+ private CmisRepositoryService fRepositoryService;
+ private CmisNavigationService fNavigationService;
+ private CmisObjectService fObjectService;
+ private CmisVersioningService fVersioningService;
+ private CmisAclService fAclService;
+
+ public ServicesFactory() {
+ }
+
+ @Override
+ public void init(Map<String, String> parameters) {
+ fRepositoryMap = new RepositoryMap();
+ fTypeManager = new TypeManager();
+
+ readConfiguration(parameters);
+
+ // create service object with wrappers
+ fRepositoryService = new RepositoryServiceWrapper(new RepositoryService(fRepositoryMap),
+ DEFAULT_MAX_ITEMS_TYPES, DEFAULT_DEPTH_TYPES);
+ fNavigationService = new NavigationServiceWrapper(new NavigationService(fRepositoryMap),
+ DEFAULT_MAX_ITEMS_OBJECTS, DEFAULT_DEPTH_OBJECTS);
+ fObjectService = new ObjectServiceWrapper(new ObjectService(fRepositoryMap), DEFAULT_MAX_ITEMS_OBJECTS);
+ fVersioningService = new VersioningServiceWrapper(new VersioningService(fRepositoryMap));
+ fAclService = new AclServiceWrapper(new AclService(fRepositoryMap));
+ }
+
+ @Override
+ public CmisRepositoryService getRepositoryService() {
+ return fRepositoryService;
+ }
+
+ @Override
+ public CmisNavigationService getNavigationService() {
+ return fNavigationService;
+ }
+
+ @Override
+ public CmisObjectService getObjectService() {
+ return fObjectService;
+ }
+
+ @Override
+ public CmisVersioningService getVersioningService() {
+ return fVersioningService;
+ }
+
+ @Override
+ public CmisAclService getAclService() {
+ return fAclService;
+ }
+
+ // ---- helpers ----
+
+ private void readConfiguration(Map<String, String> parameters) {
+ List<String> keys = new ArrayList<String>(parameters.keySet());
+ Collections.sort(keys);
+
+ for (String key : keys) {
+ if (key.startsWith(PREFIX_LOGIN)) {
+ // get logins
+ String usernameAndPassword = replaceSystemProperties(parameters.get(key));
+ if (usernameAndPassword == null) {
+ continue;
+ }
+
+ String username = usernameAndPassword;
+ String password = "";
+
+ int x = usernameAndPassword.indexOf(':');
+ if (x > -1) {
+ username = usernameAndPassword.substring(0, x);
+ password = usernameAndPassword.substring(x + 1);
+ }
+
+ fRepositoryMap.addLogin(username, password);
+
+ log.info("Added login '" + username + "'.");
+ } else if (key.startsWith(PREFIX_TYPE)) {
+ // load type definition
+ TypeDefinition type = loadType(replaceSystemProperties(parameters.get(key)));
+ if (type != null) {
+ fTypeManager.addType(type);
+ }
+ } else if (key.startsWith(PREFIX_REPOSITORY)) {
+ // configure repositories
+ String repositoryId = key.substring(PREFIX_REPOSITORY.length()).trim();
+ int x = repositoryId.lastIndexOf('.');
+ if (x > 0) {
+ repositoryId = repositoryId.substring(0, x);
+ }
+
+ if (repositoryId.length() == 0) {
+ throw new IllegalArgumentException("No repository id!");
+ }
+
+ if (key.endsWith(SUFFIX_READWRITE)) {
+ // read-write users
+ FileShareRepository fsr = fRepositoryMap.getRepository(repositoryId);
+ for (String user : split(parameters.get(key))) {
+ fsr.addUser(replaceSystemProperties(user), false);
+ }
+ } else if (key.endsWith(SUFFIX_READONLY)) {
+ // read-only users
+ FileShareRepository fsr = fRepositoryMap.getRepository(repositoryId);
+ for (String user : split(parameters.get(key))) {
+ fsr.addUser(replaceSystemProperties(user), true);
+ }
+ } else {
+ // new repository
+ String root = replaceSystemProperties(parameters.get(key));
+ FileShareRepository fsr = new FileShareRepository(repositoryId, root, fTypeManager);
+
+ fRepositoryMap.addRepository(fsr);
+
+ log.info("Added repository '" + fsr.getRepositoryId() + "': " + root);
+ }
+ }
+ }
+ }
+
+ private List<String> split(String csl) {
+ if (csl == null) {
+ return Collections.emptyList();
+ }
+
+ List<String> result = new ArrayList<String>();
+ for (String s : csl.split(",")) {
+ result.add(s.trim());
+ }
+
+ return result;
+ }
+
+ private String replaceSystemProperties(String s) {
+ if (s == null) {
+ return null;
+ }
+
+ StringBuilder result = new StringBuilder();
+ StringBuilder property = null;
+ boolean inProperty = false;
+
+ for (int i = 0; i < s.length(); i++) {
+ char c = s.charAt(i);
+
+ if (inProperty) {
+ if (c == '}') {
+ String value = System.getProperty(property.toString());
+ if (value != null) {
+ result.append(value);
+ }
+ inProperty = false;
+ } else {
+ property.append(c);
+ }
+ } else {
+ if (c == '{') {
+ property = new StringBuilder();
+ inProperty = true;
+ } else {
+ result.append(c);
+ }
+ }
+ }
+
+ return result.toString();
+ }
+
+ @SuppressWarnings("unchecked")
+ private TypeDefinition loadType(String filename) {
+ TypeDefinition result = null;
+
+ try {
+ Unmarshaller u = JaxBHelper.createUnmarshaller();
+ JAXBElement<CmisTypeDefinitionType> type = (JAXBElement<CmisTypeDefinitionType>) u.unmarshal(new File(
+ filename));
+ result = Converter.convert(type.getValue());
+ } catch (Exception e) {
+ log.info("Could not load type: '" + filename + "'", e);
+ }
- return result;
- }
+ return result;
+ }
}
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/TypeManager.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/TypeManager.java?rev=934896&r1=934895&r2=934896&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/TypeManager.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/TypeManager.java Fri Apr 16 14:14:00 2010
@@ -64,499 +64,483 @@ import org.apache.commons.logging.LogFac
*
*/
public class TypeManager {
- public final static String DOCUMENT_TYPE_ID = "cmis:document";
- public final static String FOLDER_TYPE_ID = "cmis:folder";
- public final static String RELATIONSHIP_TYPE_ID = "cmis:relationship";
- public final static String POLICY_TYPE_ID = "cmis:policy";
-
- private static final String NAMESPACE = "http://opencmis.org/fileshare";
-
- private static final Log log = LogFactory.getLog(TypeManager.class);
-
- private Map<String, TypeDefinitionContainerImpl> fTypes;
- private List<TypeDefinitionContainer> fTypesList;
-
- public TypeManager() {
- setup();
- }
-
- /**
- * Creates the base types.
- */
- private void setup() {
- fTypes = new HashMap<String, TypeDefinitionContainerImpl>();
- fTypesList = new ArrayList<TypeDefinitionContainer>();
-
- // folder type
- FolderTypeDefinitionImpl folderType = new FolderTypeDefinitionImpl();
- folderType.setBaseTypeId(BaseTypeId.CMIS_FOLDER);
- folderType.setIsControllableAcl(false);
- folderType.setIsControllablePolicy(false);
- folderType.setIsCreatable(true);
- folderType.setDescription("Folder");
- folderType.setDisplayName("Folder");
- folderType.setIsFileable(true);
- folderType.setIsFulltextIndexed(false);
- folderType.setIsIncludedInSupertypeQuery(true);
- folderType.setLocalName("Folder");
- folderType.setLocalNamespace(NAMESPACE);
- folderType.setIsQueryable(false);
- folderType.setQueryName("cmis:folder");
- folderType.setId(FOLDER_TYPE_ID);
-
- addBasePropertyDefinitions(folderType);
- addFolderPropertyDefinitions(folderType);
-
- addTypeInteral(folderType);
-
- // document type
- DocumentTypeDefinitionImpl documentType = new DocumentTypeDefinitionImpl();
- documentType.setBaseTypeId(BaseTypeId.CMIS_DOCUMENT);
- documentType.setIsControllableAcl(false);
- documentType.setIsControllablePolicy(false);
- documentType.setIsCreatable(true);
- documentType.setDescription("Document");
- documentType.setDisplayName("Document");
- documentType.setIsFileable(true);
- documentType.setIsFulltextIndexed(false);
- documentType.setIsIncludedInSupertypeQuery(true);
- documentType.setLocalName("Document");
- documentType.setLocalNamespace(NAMESPACE);
- documentType.setIsQueryable(false);
- documentType.setQueryName("cmis:document");
- documentType.setId(DOCUMENT_TYPE_ID);
-
- documentType.setIsVersionable(false);
- documentType.setContentStreamAllowed(ContentStreamAllowed.ALLOWED);
-
- addBasePropertyDefinitions(documentType);
- addDocumentPropertyDefinitions(documentType);
-
- addTypeInteral(documentType);
-
- // relationship types
- RelationshipTypeDefinitionImpl relationshipType = new RelationshipTypeDefinitionImpl();
- relationshipType.setBaseTypeId(BaseTypeId.CMIS_RELATIONSHIP);
- relationshipType.setIsControllableAcl(false);
- relationshipType.setIsControllablePolicy(false);
- relationshipType.setIsCreatable(false);
- relationshipType.setDescription("Relationship");
- relationshipType.setDisplayName("Relationship");
- relationshipType.setIsFileable(false);
- relationshipType.setIsIncludedInSupertypeQuery(true);
- relationshipType.setLocalName("Relationship");
- relationshipType.setLocalNamespace(NAMESPACE);
- relationshipType.setIsQueryable(false);
- relationshipType.setQueryName("cmis:relationship");
- relationshipType.setId(RELATIONSHIP_TYPE_ID);
-
- addBasePropertyDefinitions(relationshipType);
-
- // not supported - don't expose it
- // addTypeInteral(relationshipType);
-
- // policy type
- PolicyTypeDefinitionImpl policyType = new PolicyTypeDefinitionImpl();
- policyType.setBaseTypeId(BaseTypeId.CMIS_POLICY);
- policyType.setIsControllableAcl(false);
- policyType.setIsControllablePolicy(false);
- policyType.setIsCreatable(false);
- policyType.setDescription("Policy");
- policyType.setDisplayName("Policy");
- policyType.setIsFileable(false);
- policyType.setIsIncludedInSupertypeQuery(true);
- policyType.setLocalName("Policy");
- policyType.setLocalNamespace(NAMESPACE);
- policyType.setIsQueryable(false);
- policyType.setQueryName("cmis:policy");
- policyType.setId(POLICY_TYPE_ID);
-
- addBasePropertyDefinitions(policyType);
-
- // not supported - don't expose it
- // addTypeInteral(policyType);
- }
-
- private void addBasePropertyDefinitions(AbstractTypeDefinition type) {
- type.addPropertyDefinition(createPropDef(PropertyIds.BASE_TYPE_ID, "Base Type Id",
- "Base Type Id", PropertyType.ID, Cardinality.SINGLE, Updatability.READONLY, false, true));
-
- type.addPropertyDefinition(createPropDef(PropertyIds.OBJECT_ID, "Object Id", "Object Id",
- PropertyType.ID, Cardinality.SINGLE, Updatability.READONLY, false, true));
-
- type.addPropertyDefinition(createPropDef(PropertyIds.OBJECT_TYPE_ID, "Type Id", "Type Id",
- PropertyType.ID, Cardinality.SINGLE, Updatability.READONLY, false, true));
-
- type.addPropertyDefinition(createPropDef(PropertyIds.NAME, "Name", "Name",
- PropertyType.STRING, Cardinality.SINGLE, Updatability.READWRITE, false, true));
-
- type.addPropertyDefinition(createPropDef(PropertyIds.CREATED_BY, "Created By",
- "Created By", PropertyType.STRING, Cardinality.SINGLE, Updatability.READONLY, false, true));
-
- type.addPropertyDefinition(createPropDef(PropertyIds.CREATION_DATE, "Creation Date",
- "Creation Date", PropertyType.DATETIME, Cardinality.SINGLE, Updatability.READONLY, false,
- true));
-
- type.addPropertyDefinition(createPropDef(PropertyIds.LAST_MODIFIED_BY, "Last Modified By",
- "Last Modified By", PropertyType.STRING, Cardinality.SINGLE, Updatability.READONLY, false,
- true));
-
- type.addPropertyDefinition(createPropDef(PropertyIds.LAST_MODIFICATION_DATE,
- "Last Modification Date", "Last Modification Date", PropertyType.DATETIME,
- Cardinality.SINGLE, Updatability.READONLY, false, true));
-
- type.addPropertyDefinition(createPropDef(PropertyIds.CHANGE_TOKEN, "Change Token",
- "Change Token", PropertyType.STRING, Cardinality.SINGLE, Updatability.READONLY, false,
- false));
- }
-
- private void addFolderPropertyDefinitions(FolderTypeDefinitionImpl type) {
- type.addPropertyDefinition(createPropDef(PropertyIds.PARENT_ID, "Parent Id", "Parent Id",
- PropertyType.ID, Cardinality.SINGLE, Updatability.READONLY, false, false));
-
- type.addPropertyDefinition(createPropDef(PropertyIds.ALLOWED_CHILD_OBJECT_TYPE_IDS,
- "Allowed Child Object Type Ids", "Allowed Child Object Type Ids", PropertyType.ID,
- Cardinality.MULTI, Updatability.READONLY, false, false));
-
- type.addPropertyDefinition(createPropDef(PropertyIds.PATH, "Path", "Path",
- PropertyType.STRING, Cardinality.SINGLE, Updatability.READONLY, false, false));
- }
-
- private void addDocumentPropertyDefinitions(DocumentTypeDefinitionImpl type) {
- type.addPropertyDefinition(createPropDef(PropertyIds.IS_IMMUTABLE, "Is Immutable",
- "Is Immutable", PropertyType.BOOLEAN, Cardinality.SINGLE, Updatability.READONLY, false,
- false));
-
- type.addPropertyDefinition(createPropDef(PropertyIds.IS_LATEST_VERSION,
- "Is Latest Version", "Is Latest Version", PropertyType.BOOLEAN, Cardinality.SINGLE,
- Updatability.READONLY, false, false));
-
- type.addPropertyDefinition(createPropDef(PropertyIds.IS_MAJOR_VERSION, "Is Major Version",
- "Is Major Version", PropertyType.BOOLEAN, Cardinality.SINGLE, Updatability.READONLY, false,
- false));
-
- type.addPropertyDefinition(createPropDef(PropertyIds.IS_LATEST_MAJOR_VERSION,
- "Is Latest Major Version", "Is Latest Major Version", PropertyType.BOOLEAN,
- Cardinality.SINGLE, Updatability.READONLY, false, false));
-
- type.addPropertyDefinition(createPropDef(PropertyIds.VERSION_LABEL, "Version Label",
- "Version Label", PropertyType.STRING, Cardinality.SINGLE, Updatability.READONLY, false,
- true));
-
- type.addPropertyDefinition(createPropDef(PropertyIds.VERSION_SERIES_ID,
- "Version Series Id", "Version Series Id", PropertyType.ID, Cardinality.SINGLE,
- Updatability.READONLY, false, true));
-
- type.addPropertyDefinition(createPropDef(PropertyIds.IS_VERSION_SERIES_CHECKED_OUT,
- "Is Verison Series Checked Out", "Is Verison Series Checked Out", PropertyType.BOOLEAN,
- Cardinality.SINGLE, Updatability.READONLY, false, true));
-
- type.addPropertyDefinition(createPropDef(PropertyIds.VERSION_SERIES_CHECKED_OUT_ID,
- "Version Series Checked Out Id", "Version Series Checked Out Id", PropertyType.ID,
- Cardinality.SINGLE, Updatability.READONLY, false, false));
-
- type.addPropertyDefinition(createPropDef(PropertyIds.CHECKIN_COMMENT, "Checkin Comment",
- "Checkin Comment", PropertyType.STRING, Cardinality.SINGLE, Updatability.READONLY, false,
- false));
-
- type.addPropertyDefinition(createPropDef(PropertyIds.CONTENT_STREAM_LENGTH,
- "Content Stream Length", "Content Stream Length", PropertyType.INTEGER, Cardinality.SINGLE,
- Updatability.READONLY, false, false));
-
- type.addPropertyDefinition(createPropDef(PropertyIds.CONTENT_STREAM_MIME_TYPE,
- "MIME Type", "MIME Type", PropertyType.STRING, Cardinality.SINGLE, Updatability.READONLY,
- false, false));
-
- type.addPropertyDefinition(createPropDef(PropertyIds.CONTENT_STREAM_FILE_NAME, "Filename",
- "Filename", PropertyType.STRING, Cardinality.SINGLE, Updatability.READONLY, false, false));
-
- type.addPropertyDefinition(createPropDef(PropertyIds.CONTENT_STREAM_ID,
- "Content Stream Id", "Content Stream Id", PropertyType.ID, Cardinality.SINGLE,
- Updatability.READONLY, false, false));
- }
-
- /**
- * Creates a property definition object.
- */
- private PropertyDefinition<?> createPropDef(String id, String displayName, String description,
- PropertyType datatype, Cardinality cardinality, Updatability updateability,
- boolean inherited, boolean required) {
- AbstractPropertyDefinition<?> result = null;
-
- switch (datatype) {
- case BOOLEAN:
- result = new PropertyBooleanDefinitionImpl();
- break;
- case DATETIME:
- result = new PropertyDateTimeDefinitionImpl();
- break;
- case DECIMAL:
- result = new PropertyDecimalDefinitionImpl();
- break;
- case HTML:
- result = new PropertyHtmlDefinitionImpl();
- break;
- case ID:
- result = new PropertyIdDefinitionImpl();
- break;
- case INTEGER:
- result = new PropertyIntegerDefinitionImpl();
- break;
- case STRING:
- result = new PropertyStringDefinitionImpl();
- break;
- case URI:
- result = new PropertyUriDefinitionImpl();
- break;
- default:
- throw new RuntimeException("Unknown datatype! Spec change?");
- }
-
- result.setId(id);
- result.setLocalName(id);
- result.setDisplayName(displayName);
- result.setDescription(description);
- result.setPropertyType(datatype);
- result.setCardinality(cardinality);
- result.setUpdatability(updateability);
- result.setIsInherited(inherited);
- result.setIsRequired(required);
- result.setIsQueryable(false);
- result.setQueryName(id);
-
- return result;
- }
-
- /**
- * Adds a type to collection with inheriting base type properties.
- */
- public boolean addType(TypeDefinition type) {
- if (type == null) {
- return false;
- }
-
- if (type.getBaseTypeId() == null) {
- return false;
- }
-
- // find base type
- TypeDefinition baseType = null;
- if (type.getBaseTypeId() == BaseTypeId.CMIS_DOCUMENT) {
- baseType = copyTypeDefintion(fTypes.get(DOCUMENT_TYPE_ID).getTypeDefinition());
- }
- else if (type.getBaseTypeId() == BaseTypeId.CMIS_FOLDER) {
- baseType = copyTypeDefintion(fTypes.get(FOLDER_TYPE_ID).getTypeDefinition());
- }
- else if (type.getBaseTypeId() == BaseTypeId.CMIS_RELATIONSHIP) {
- baseType = copyTypeDefintion(fTypes.get(RELATIONSHIP_TYPE_ID).getTypeDefinition());
- }
- else if (type.getBaseTypeId() == BaseTypeId.CMIS_POLICY) {
- baseType = copyTypeDefintion(fTypes.get(POLICY_TYPE_ID).getTypeDefinition());
- }
- else {
- return false;
- }
-
- AbstractTypeDefinition newType = (AbstractTypeDefinition) copyTypeDefintion(type);
-
- // copy property definition
- for (PropertyDefinition<?> propDef : baseType.getPropertyDefinitions().values()) {
- ((AbstractPropertyDefinition<?>) propDef).setIsInherited(true);
- newType.addPropertyDefinition(propDef);
- }
-
- // add it
- addTypeInteral(newType);
-
- log.info("Added type '" + newType.getId() + "'.");
-
- return true;
- }
-
- /**
- * Adds a type to collection.
- */
- private void addTypeInteral(AbstractTypeDefinition type) {
- if (type == null) {
- return;
- }
-
- if (fTypes.containsKey(type.getId())) {
- // can't overwrite a type
- return;
- }
-
- TypeDefinitionContainerImpl tc = new TypeDefinitionContainerImpl();
- tc.setTypeDefinition(type);
-
- // add to parent
- if (type.getParentTypeId() != null) {
- TypeDefinitionContainerImpl tdc = fTypes.get(type.getParentTypeId());
- if (tdc != null) {
- if (tdc.getChildren() == null) {
- tdc.setChildren(new ArrayList<TypeDefinitionContainer>());
- }
- tdc.getChildren().add(tc);
- }
- }
-
- fTypes.put(type.getId(), tc);
- fTypesList.add(tc);
- }
-
- /**
- * CMIS getTypesChildren.
- */
- public TypeDefinitionList getTypesChildren(CallContext context, String typeId,
- boolean includePropertyDefinitions, BigInteger maxItems, BigInteger skipCount) {
- TypeDefinitionListImpl result = new TypeDefinitionListImpl();
- result.setList(new ArrayList<TypeDefinition>());
- result.setHasMoreItems(false);
- result.setNumItems(BigInteger.valueOf(0));
-
- int skip = (skipCount == null ? 0 : skipCount.intValue());
- if (skip < 0) {
- skip = 0;
- }
-
- int max = (maxItems == null ? Integer.MAX_VALUE : maxItems.intValue());
- if (max < 1) {
- return result;
- }
-
- if (typeId == null) {
- if (skip < 1) {
- result.getList().add(copyTypeDefintion(fTypes.get(FOLDER_TYPE_ID).getTypeDefinition()));
- max--;
- }
- if ((skip < 2) && (max > 0)) {
- result.getList().add(copyTypeDefintion(fTypes.get(DOCUMENT_TYPE_ID).getTypeDefinition()));
- max--;
- }
-
- result.setHasMoreItems((result.getList().size() + skip) < 2);
- result.setNumItems(BigInteger.valueOf(2));
- }
- else {
- TypeDefinitionContainer tc = fTypes.get(typeId);
- if ((tc == null) || (tc.getChildren() == null)) {
- return result;
- }
-
- for (TypeDefinitionContainer child : tc.getChildren()) {
- if (skip > 0) {
- skip--;
- continue;
- }
-
- result.getList().add(copyTypeDefintion(child.getTypeDefinition()));
-
- max--;
- if (max == 0) {
- break;
- }
- }
-
- result.setHasMoreItems((result.getList().size() + skip) < tc.getChildren().size());
- result.setNumItems(BigInteger.valueOf(tc.getChildren().size()));
- }
-
- if (!includePropertyDefinitions) {
- for (TypeDefinition type : result.getList()) {
- type.getPropertyDefinitions().clear();
- }
- }
-
- return result;
- }
-
- /**
- * CMIS getTypesDescendants.
- */
- public List<TypeDefinitionContainer> getTypesDescendants(CallContext context, String typeId,
- BigInteger depth, Boolean includePropertyDefinitions) {
- List<TypeDefinitionContainer> result = new ArrayList<TypeDefinitionContainer>();
-
- // check depth
- int d = (depth == null ? -1 : depth.intValue());
- if (d == 0) {
- throw new CmisInvalidArgumentException("Depth must not be 0!");
- }
-
- // set property definition flag to default value if not set
- boolean ipd = (includePropertyDefinitions == null ? false : includePropertyDefinitions
- .booleanValue());
-
- if (typeId == null) {
- result.add(getTypesDescendants(d, fTypes.get(FOLDER_TYPE_ID), ipd));
- result.add(getTypesDescendants(d, fTypes.get(DOCUMENT_TYPE_ID), ipd));
- // result.add(getTypesDescendants(depth,
- // fTypes.get(RELATIONSHIP_TYPE_ID), includePropertyDefinitions));
- // result.add(getTypesDescendants(depth, fTypes.get(POLICY_TYPE_ID),
- // includePropertyDefinitions));
- }
- else {
- TypeDefinitionContainer tc = fTypes.get(typeId);
- if (tc != null) {
- result.add(getTypesDescendants(d, tc, ipd));
- }
- }
-
- return result;
- }
-
- /**
- * Gathers the type descendants tree.
- */
- private TypeDefinitionContainer getTypesDescendants(int depth, TypeDefinitionContainer tc,
- boolean includePropertyDefinitions) {
- TypeDefinitionContainerImpl result = new TypeDefinitionContainerImpl();
-
- TypeDefinition type = copyTypeDefintion(tc.getTypeDefinition());
- if (!includePropertyDefinitions) {
- type.getPropertyDefinitions().clear();
- }
-
- result.setTypeDefinition(type);
-
- if (depth != 0) {
- if (tc.getChildren() != null) {
- result.setChildren(new ArrayList<TypeDefinitionContainer>());
- for (TypeDefinitionContainer tdc : tc.getChildren()) {
- result.getChildren().add(
- getTypesDescendants(depth < 0 ? -1 : depth - 1, tdc, includePropertyDefinitions));
- }
- }
- }
-
- return result;
- }
-
- /**
- * For internal use.
- */
- public TypeDefinition getType(String typeId) {
- TypeDefinitionContainer tc = fTypes.get(typeId);
- if (tc == null) {
- return null;
- }
-
- return tc.getTypeDefinition();
- }
-
- /**
- * CMIS getTypeDefinition.
- */
- public TypeDefinition getTypeDefinition(CallContext context, String typeId) {
- TypeDefinitionContainer tc = fTypes.get(typeId);
- if (tc == null) {
- throw new CmisObjectNotFoundException("Type '" + typeId + "' is unknown!");
- }
-
- return copyTypeDefintion(tc.getTypeDefinition());
- }
-
- private TypeDefinition copyTypeDefintion(TypeDefinition type) {
- return Converter.convert(Converter.convert(type));
- }
+ public final static String DOCUMENT_TYPE_ID = "cmis:document";
+ public final static String FOLDER_TYPE_ID = "cmis:folder";
+ public final static String RELATIONSHIP_TYPE_ID = "cmis:relationship";
+ public final static String POLICY_TYPE_ID = "cmis:policy";
+
+ private static final String NAMESPACE = "http://opencmis.org/fileshare";
+
+ private static final Log log = LogFactory.getLog(TypeManager.class);
+
+ private Map<String, TypeDefinitionContainerImpl> fTypes;
+ private List<TypeDefinitionContainer> fTypesList;
+
+ public TypeManager() {
+ setup();
+ }
+
+ /**
+ * Creates the base types.
+ */
+ private void setup() {
+ fTypes = new HashMap<String, TypeDefinitionContainerImpl>();
+ fTypesList = new ArrayList<TypeDefinitionContainer>();
+
+ // folder type
+ FolderTypeDefinitionImpl folderType = new FolderTypeDefinitionImpl();
+ folderType.setBaseTypeId(BaseTypeId.CMIS_FOLDER);
+ folderType.setIsControllableAcl(false);
+ folderType.setIsControllablePolicy(false);
+ folderType.setIsCreatable(true);
+ folderType.setDescription("Folder");
+ folderType.setDisplayName("Folder");
+ folderType.setIsFileable(true);
+ folderType.setIsFulltextIndexed(false);
+ folderType.setIsIncludedInSupertypeQuery(true);
+ folderType.setLocalName("Folder");
+ folderType.setLocalNamespace(NAMESPACE);
+ folderType.setIsQueryable(false);
+ folderType.setQueryName("cmis:folder");
+ folderType.setId(FOLDER_TYPE_ID);
+
+ addBasePropertyDefinitions(folderType);
+ addFolderPropertyDefinitions(folderType);
+
+ addTypeInteral(folderType);
+
+ // document type
+ DocumentTypeDefinitionImpl documentType = new DocumentTypeDefinitionImpl();
+ documentType.setBaseTypeId(BaseTypeId.CMIS_DOCUMENT);
+ documentType.setIsControllableAcl(false);
+ documentType.setIsControllablePolicy(false);
+ documentType.setIsCreatable(true);
+ documentType.setDescription("Document");
+ documentType.setDisplayName("Document");
+ documentType.setIsFileable(true);
+ documentType.setIsFulltextIndexed(false);
+ documentType.setIsIncludedInSupertypeQuery(true);
+ documentType.setLocalName("Document");
+ documentType.setLocalNamespace(NAMESPACE);
+ documentType.setIsQueryable(false);
+ documentType.setQueryName("cmis:document");
+ documentType.setId(DOCUMENT_TYPE_ID);
+
+ documentType.setIsVersionable(false);
+ documentType.setContentStreamAllowed(ContentStreamAllowed.ALLOWED);
+
+ addBasePropertyDefinitions(documentType);
+ addDocumentPropertyDefinitions(documentType);
+
+ addTypeInteral(documentType);
+
+ // relationship types
+ RelationshipTypeDefinitionImpl relationshipType = new RelationshipTypeDefinitionImpl();
+ relationshipType.setBaseTypeId(BaseTypeId.CMIS_RELATIONSHIP);
+ relationshipType.setIsControllableAcl(false);
+ relationshipType.setIsControllablePolicy(false);
+ relationshipType.setIsCreatable(false);
+ relationshipType.setDescription("Relationship");
+ relationshipType.setDisplayName("Relationship");
+ relationshipType.setIsFileable(false);
+ relationshipType.setIsIncludedInSupertypeQuery(true);
+ relationshipType.setLocalName("Relationship");
+ relationshipType.setLocalNamespace(NAMESPACE);
+ relationshipType.setIsQueryable(false);
+ relationshipType.setQueryName("cmis:relationship");
+ relationshipType.setId(RELATIONSHIP_TYPE_ID);
+
+ addBasePropertyDefinitions(relationshipType);
+
+ // not supported - don't expose it
+ // addTypeInteral(relationshipType);
+
+ // policy type
+ PolicyTypeDefinitionImpl policyType = new PolicyTypeDefinitionImpl();
+ policyType.setBaseTypeId(BaseTypeId.CMIS_POLICY);
+ policyType.setIsControllableAcl(false);
+ policyType.setIsControllablePolicy(false);
+ policyType.setIsCreatable(false);
+ policyType.setDescription("Policy");
+ policyType.setDisplayName("Policy");
+ policyType.setIsFileable(false);
+ policyType.setIsIncludedInSupertypeQuery(true);
+ policyType.setLocalName("Policy");
+ policyType.setLocalNamespace(NAMESPACE);
+ policyType.setIsQueryable(false);
+ policyType.setQueryName("cmis:policy");
+ policyType.setId(POLICY_TYPE_ID);
+
+ addBasePropertyDefinitions(policyType);
+
+ // not supported - don't expose it
+ // addTypeInteral(policyType);
+ }
+
+ private void addBasePropertyDefinitions(AbstractTypeDefinition type) {
+ type.addPropertyDefinition(createPropDef(PropertyIds.BASE_TYPE_ID, "Base Type Id", "Base Type Id",
+ PropertyType.ID, Cardinality.SINGLE, Updatability.READONLY, false, true));
+
+ type.addPropertyDefinition(createPropDef(PropertyIds.OBJECT_ID, "Object Id", "Object Id", PropertyType.ID,
+ Cardinality.SINGLE, Updatability.READONLY, false, true));
+
+ type.addPropertyDefinition(createPropDef(PropertyIds.OBJECT_TYPE_ID, "Type Id", "Type Id", PropertyType.ID,
+ Cardinality.SINGLE, Updatability.READONLY, false, true));
+
+ type.addPropertyDefinition(createPropDef(PropertyIds.NAME, "Name", "Name", PropertyType.STRING,
+ Cardinality.SINGLE, Updatability.READWRITE, false, true));
+
+ type.addPropertyDefinition(createPropDef(PropertyIds.CREATED_BY, "Created By", "Created By",
+ PropertyType.STRING, Cardinality.SINGLE, Updatability.READONLY, false, true));
+
+ type.addPropertyDefinition(createPropDef(PropertyIds.CREATION_DATE, "Creation Date", "Creation Date",
+ PropertyType.DATETIME, Cardinality.SINGLE, Updatability.READONLY, false, true));
+
+ type.addPropertyDefinition(createPropDef(PropertyIds.LAST_MODIFIED_BY, "Last Modified By", "Last Modified By",
+ PropertyType.STRING, Cardinality.SINGLE, Updatability.READONLY, false, true));
+
+ type
+ .addPropertyDefinition(createPropDef(PropertyIds.LAST_MODIFICATION_DATE, "Last Modification Date",
+ "Last Modification Date", PropertyType.DATETIME, Cardinality.SINGLE, Updatability.READONLY,
+ false, true));
+
+ type.addPropertyDefinition(createPropDef(PropertyIds.CHANGE_TOKEN, "Change Token", "Change Token",
+ PropertyType.STRING, Cardinality.SINGLE, Updatability.READONLY, false, false));
+ }
+
+ private void addFolderPropertyDefinitions(FolderTypeDefinitionImpl type) {
+ type.addPropertyDefinition(createPropDef(PropertyIds.PARENT_ID, "Parent Id", "Parent Id", PropertyType.ID,
+ Cardinality.SINGLE, Updatability.READONLY, false, false));
+
+ type.addPropertyDefinition(createPropDef(PropertyIds.ALLOWED_CHILD_OBJECT_TYPE_IDS,
+ "Allowed Child Object Type Ids", "Allowed Child Object Type Ids", PropertyType.ID, Cardinality.MULTI,
+ Updatability.READONLY, false, false));
+
+ type.addPropertyDefinition(createPropDef(PropertyIds.PATH, "Path", "Path", PropertyType.STRING,
+ Cardinality.SINGLE, Updatability.READONLY, false, false));
+ }
+
+ private void addDocumentPropertyDefinitions(DocumentTypeDefinitionImpl type) {
+ type.addPropertyDefinition(createPropDef(PropertyIds.IS_IMMUTABLE, "Is Immutable", "Is Immutable",
+ PropertyType.BOOLEAN, Cardinality.SINGLE, Updatability.READONLY, false, false));
+
+ type.addPropertyDefinition(createPropDef(PropertyIds.IS_LATEST_VERSION, "Is Latest Version",
+ "Is Latest Version", PropertyType.BOOLEAN, Cardinality.SINGLE, Updatability.READONLY, false, false));
+
+ type.addPropertyDefinition(createPropDef(PropertyIds.IS_MAJOR_VERSION, "Is Major Version", "Is Major Version",
+ PropertyType.BOOLEAN, Cardinality.SINGLE, Updatability.READONLY, false, false));
+
+ type.addPropertyDefinition(createPropDef(PropertyIds.IS_LATEST_MAJOR_VERSION, "Is Latest Major Version",
+ "Is Latest Major Version", PropertyType.BOOLEAN, Cardinality.SINGLE, Updatability.READONLY, false,
+ false));
+
+ type.addPropertyDefinition(createPropDef(PropertyIds.VERSION_LABEL, "Version Label", "Version Label",
+ PropertyType.STRING, Cardinality.SINGLE, Updatability.READONLY, false, true));
+
+ type.addPropertyDefinition(createPropDef(PropertyIds.VERSION_SERIES_ID, "Version Series Id",
+ "Version Series Id", PropertyType.ID, Cardinality.SINGLE, Updatability.READONLY, false, true));
+
+ type.addPropertyDefinition(createPropDef(PropertyIds.IS_VERSION_SERIES_CHECKED_OUT,
+ "Is Verison Series Checked Out", "Is Verison Series Checked Out", PropertyType.BOOLEAN,
+ Cardinality.SINGLE, Updatability.READONLY, false, true));
+
+ type.addPropertyDefinition(createPropDef(PropertyIds.VERSION_SERIES_CHECKED_OUT_ID,
+ "Version Series Checked Out Id", "Version Series Checked Out Id", PropertyType.ID, Cardinality.SINGLE,
+ Updatability.READONLY, false, false));
+
+ type.addPropertyDefinition(createPropDef(PropertyIds.CHECKIN_COMMENT, "Checkin Comment", "Checkin Comment",
+ PropertyType.STRING, Cardinality.SINGLE, Updatability.READONLY, false, false));
+
+ type
+ .addPropertyDefinition(createPropDef(PropertyIds.CONTENT_STREAM_LENGTH, "Content Stream Length",
+ "Content Stream Length", PropertyType.INTEGER, Cardinality.SINGLE, Updatability.READONLY,
+ false, false));
+
+ type.addPropertyDefinition(createPropDef(PropertyIds.CONTENT_STREAM_MIME_TYPE, "MIME Type", "MIME Type",
+ PropertyType.STRING, Cardinality.SINGLE, Updatability.READONLY, false, false));
+
+ type.addPropertyDefinition(createPropDef(PropertyIds.CONTENT_STREAM_FILE_NAME, "Filename", "Filename",
+ PropertyType.STRING, Cardinality.SINGLE, Updatability.READONLY, false, false));
+
+ type.addPropertyDefinition(createPropDef(PropertyIds.CONTENT_STREAM_ID, "Content Stream Id",
+ "Content Stream Id", PropertyType.ID, Cardinality.SINGLE, Updatability.READONLY, false, false));
+ }
+
+ /**
+ * Creates a property definition object.
+ */
+ private PropertyDefinition<?> createPropDef(String id, String displayName, String description,
+ PropertyType datatype, Cardinality cardinality, Updatability updateability, boolean inherited,
+ boolean required) {
+ AbstractPropertyDefinition<?> result = null;
+
+ switch (datatype) {
+ case BOOLEAN:
+ result = new PropertyBooleanDefinitionImpl();
+ break;
+ case DATETIME:
+ result = new PropertyDateTimeDefinitionImpl();
+ break;
+ case DECIMAL:
+ result = new PropertyDecimalDefinitionImpl();
+ break;
+ case HTML:
+ result = new PropertyHtmlDefinitionImpl();
+ break;
+ case ID:
+ result = new PropertyIdDefinitionImpl();
+ break;
+ case INTEGER:
+ result = new PropertyIntegerDefinitionImpl();
+ break;
+ case STRING:
+ result = new PropertyStringDefinitionImpl();
+ break;
+ case URI:
+ result = new PropertyUriDefinitionImpl();
+ break;
+ default:
+ throw new RuntimeException("Unknown datatype! Spec change?");
+ }
+
+ result.setId(id);
+ result.setLocalName(id);
+ result.setDisplayName(displayName);
+ result.setDescription(description);
+ result.setPropertyType(datatype);
+ result.setCardinality(cardinality);
+ result.setUpdatability(updateability);
+ result.setIsInherited(inherited);
+ result.setIsRequired(required);
+ result.setIsQueryable(false);
+ result.setQueryName(id);
+
+ return result;
+ }
+
+ /**
+ * Adds a type to collection with inheriting base type properties.
+ */
+ public boolean addType(TypeDefinition type) {
+ if (type == null) {
+ return false;
+ }
+
+ if (type.getBaseTypeId() == null) {
+ return false;
+ }
+
+ // find base type
+ TypeDefinition baseType = null;
+ if (type.getBaseTypeId() == BaseTypeId.CMIS_DOCUMENT) {
+ baseType = copyTypeDefintion(fTypes.get(DOCUMENT_TYPE_ID).getTypeDefinition());
+ } else if (type.getBaseTypeId() == BaseTypeId.CMIS_FOLDER) {
+ baseType = copyTypeDefintion(fTypes.get(FOLDER_TYPE_ID).getTypeDefinition());
+ } else if (type.getBaseTypeId() == BaseTypeId.CMIS_RELATIONSHIP) {
+ baseType = copyTypeDefintion(fTypes.get(RELATIONSHIP_TYPE_ID).getTypeDefinition());
+ } else if (type.getBaseTypeId() == BaseTypeId.CMIS_POLICY) {
+ baseType = copyTypeDefintion(fTypes.get(POLICY_TYPE_ID).getTypeDefinition());
+ } else {
+ return false;
+ }
+
+ AbstractTypeDefinition newType = (AbstractTypeDefinition) copyTypeDefintion(type);
+
+ // copy property definition
+ for (PropertyDefinition<?> propDef : baseType.getPropertyDefinitions().values()) {
+ ((AbstractPropertyDefinition<?>) propDef).setIsInherited(true);
+ newType.addPropertyDefinition(propDef);
+ }
+
+ // add it
+ addTypeInteral(newType);
+
+ log.info("Added type '" + newType.getId() + "'.");
+
+ return true;
+ }
+
+ /**
+ * Adds a type to collection.
+ */
+ private void addTypeInteral(AbstractTypeDefinition type) {
+ if (type == null) {
+ return;
+ }
+
+ if (fTypes.containsKey(type.getId())) {
+ // can't overwrite a type
+ return;
+ }
+
+ TypeDefinitionContainerImpl tc = new TypeDefinitionContainerImpl();
+ tc.setTypeDefinition(type);
+
+ // add to parent
+ if (type.getParentTypeId() != null) {
+ TypeDefinitionContainerImpl tdc = fTypes.get(type.getParentTypeId());
+ if (tdc != null) {
+ if (tdc.getChildren() == null) {
+ tdc.setChildren(new ArrayList<TypeDefinitionContainer>());
+ }
+ tdc.getChildren().add(tc);
+ }
+ }
+
+ fTypes.put(type.getId(), tc);
+ fTypesList.add(tc);
+ }
+
+ /**
+ * CMIS getTypesChildren.
+ */
+ public TypeDefinitionList getTypesChildren(CallContext context, String typeId, boolean includePropertyDefinitions,
+ BigInteger maxItems, BigInteger skipCount) {
+ TypeDefinitionListImpl result = new TypeDefinitionListImpl();
+ result.setList(new ArrayList<TypeDefinition>());
+ result.setHasMoreItems(false);
+ result.setNumItems(BigInteger.valueOf(0));
+
+ int skip = (skipCount == null ? 0 : skipCount.intValue());
+ if (skip < 0) {
+ skip = 0;
+ }
+
+ int max = (maxItems == null ? Integer.MAX_VALUE : maxItems.intValue());
+ if (max < 1) {
+ return result;
+ }
+
+ if (typeId == null) {
+ if (skip < 1) {
+ result.getList().add(copyTypeDefintion(fTypes.get(FOLDER_TYPE_ID).getTypeDefinition()));
+ max--;
+ }
+ if ((skip < 2) && (max > 0)) {
+ result.getList().add(copyTypeDefintion(fTypes.get(DOCUMENT_TYPE_ID).getTypeDefinition()));
+ max--;
+ }
+
+ result.setHasMoreItems((result.getList().size() + skip) < 2);
+ result.setNumItems(BigInteger.valueOf(2));
+ } else {
+ TypeDefinitionContainer tc = fTypes.get(typeId);
+ if ((tc == null) || (tc.getChildren() == null)) {
+ return result;
+ }
+
+ for (TypeDefinitionContainer child : tc.getChildren()) {
+ if (skip > 0) {
+ skip--;
+ continue;
+ }
+
+ result.getList().add(copyTypeDefintion(child.getTypeDefinition()));
+
+ max--;
+ if (max == 0) {
+ break;
+ }
+ }
+
+ result.setHasMoreItems((result.getList().size() + skip) < tc.getChildren().size());
+ result.setNumItems(BigInteger.valueOf(tc.getChildren().size()));
+ }
+
+ if (!includePropertyDefinitions) {
+ for (TypeDefinition type : result.getList()) {
+ type.getPropertyDefinitions().clear();
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * CMIS getTypesDescendants.
+ */
+ public List<TypeDefinitionContainer> getTypesDescendants(CallContext context, String typeId, BigInteger depth,
+ Boolean includePropertyDefinitions) {
+ List<TypeDefinitionContainer> result = new ArrayList<TypeDefinitionContainer>();
+
+ // check depth
+ int d = (depth == null ? -1 : depth.intValue());
+ if (d == 0) {
+ throw new CmisInvalidArgumentException("Depth must not be 0!");
+ }
+
+ // set property definition flag to default value if not set
+ boolean ipd = (includePropertyDefinitions == null ? false : includePropertyDefinitions.booleanValue());
+
+ if (typeId == null) {
+ result.add(getTypesDescendants(d, fTypes.get(FOLDER_TYPE_ID), ipd));
+ result.add(getTypesDescendants(d, fTypes.get(DOCUMENT_TYPE_ID), ipd));
+ // result.add(getTypesDescendants(depth,
+ // fTypes.get(RELATIONSHIP_TYPE_ID), includePropertyDefinitions));
+ // result.add(getTypesDescendants(depth, fTypes.get(POLICY_TYPE_ID),
+ // includePropertyDefinitions));
+ } else {
+ TypeDefinitionContainer tc = fTypes.get(typeId);
+ if (tc != null) {
+ result.add(getTypesDescendants(d, tc, ipd));
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Gathers the type descendants tree.
+ */
+ private TypeDefinitionContainer getTypesDescendants(int depth, TypeDefinitionContainer tc,
+ boolean includePropertyDefinitions) {
+ TypeDefinitionContainerImpl result = new TypeDefinitionContainerImpl();
+
+ TypeDefinition type = copyTypeDefintion(tc.getTypeDefinition());
+ if (!includePropertyDefinitions) {
+ type.getPropertyDefinitions().clear();
+ }
+
+ result.setTypeDefinition(type);
+
+ if (depth != 0) {
+ if (tc.getChildren() != null) {
+ result.setChildren(new ArrayList<TypeDefinitionContainer>());
+ for (TypeDefinitionContainer tdc : tc.getChildren()) {
+ result.getChildren().add(
+ getTypesDescendants(depth < 0 ? -1 : depth - 1, tdc, includePropertyDefinitions));
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * For internal use.
+ */
+ public TypeDefinition getType(String typeId) {
+ TypeDefinitionContainer tc = fTypes.get(typeId);
+ if (tc == null) {
+ return null;
+ }
+
+ return tc.getTypeDefinition();
+ }
+
+ /**
+ * CMIS getTypeDefinition.
+ */
+ public TypeDefinition getTypeDefinition(CallContext context, String typeId) {
+ TypeDefinitionContainer tc = fTypes.get(typeId);
+ if (tc == null) {
+ throw new CmisObjectNotFoundException("Type '" + typeId + "' is unknown!");
+ }
+
+ return copyTypeDefintion(tc.getTypeDefinition());
+ }
+
+ private TypeDefinition copyTypeDefintion(TypeDefinition type) {
+ return Converter.convert(Converter.convert(type));
+ }
}
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/VersioningService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/VersioningService.java?rev=934896&r1=934895&r2=934896&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/VersioningService.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/VersioningService.java Fri Apr 16 14:14:00 2010
@@ -41,113 +41,115 @@ import org.apache.chemistry.opencmis.ser
*/
public class VersioningService implements CmisVersioningService {
- private RepositoryMap fRepositoryMap;
+ private RepositoryMap fRepositoryMap;
- /**
- * Constructor.
- */
- public VersioningService(RepositoryMap repositoryMap) {
- fRepositoryMap = repositoryMap;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.opencmis.server.spi.CmisVersioningService#cancelCheckOut(org.apache.opencmis.server
- * .spi.CallContext , java.lang.String, java.lang.String,
- * org.apache.opencmis.commons.api.ExtensionsData)
- */
- public void cancelCheckOut(CallContext context, String repositoryId, String objectId,
- ExtensionsData extension) {
- throw new CmisNotSupportedException("cancelCheckOut not supported!");
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.opencmis.server.spi.CmisVersioningService#checkIn(org.apache.opencmis.server.spi
- * .CallContext, java.lang.String, org.apache.opencmis.commons.provider.Holder, java.lang.Boolean,
- * org.apache.opencmis.commons.provider.PropertiesData,
- * org.apache.opencmis.commons.provider.ContentStreamData, java.lang.String, java.util.List,
- * org.apache.opencmis.commons.provider.AccessControlList,
- * org.apache.opencmis.commons.provider.AccessControlList,
- * org.apache.opencmis.commons.api.ExtensionsData,
- * org.apache.opencmis.server.spi.ObjectInfoHolder)
- */
- public ObjectData checkIn(CallContext context, String repositoryId, Holder<String> objectId,
- Boolean major, Properties properties, ContentStream contentStream,
- String checkinComment, List<String> policies, Acl addAces,
- Acl removeAces, ExtensionsData extension, ObjectInfoHolder objectInfos) {
- throw new CmisNotSupportedException("checkIn not supported!");
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.opencmis.server.spi.CmisVersioningService#checkOut(org.apache.opencmis.server.spi
- * .CallContext, java.lang.String, org.apache.opencmis.commons.provider.Holder,
- * org.apache.opencmis.commons.api.ExtensionsData, org.apache.opencmis.commons.provider.Holder,
- * org.apache.opencmis.server.spi.ObjectInfoHolder)
- */
- public ObjectData checkOut(CallContext context, String repositoryId, Holder<String> objectId,
- ExtensionsData extension, Holder<Boolean> contentCopied, ObjectInfoHolder objectInfos) {
- throw new CmisNotSupportedException("checkOut not supported!");
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.opencmis.server.spi.CmisVersioningService#getAllVersions(org.apache.opencmis.server
- * .spi.CallContext , java.lang.String, java.lang.String, java.lang.String, java.lang.Boolean,
- * org.apache.opencmis.commons.api.ExtensionsData,
- * org.apache.opencmis.server.spi.ObjectInfoHolder)
- */
- public List<ObjectData> getAllVersions(CallContext context, String repositoryId,
- String versionSeriesId, String filter, Boolean includeAllowableActions,
- ExtensionsData extension, ObjectInfoHolder objectInfos) {
- ObjectData theVersion = fRepositoryMap.getAuthenticatedRepository(context, repositoryId)
- .getObject(context, versionSeriesId, filter, includeAllowableActions, false, objectInfos);
-
- return Collections.singletonList(theVersion);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.opencmis.server.spi.CmisVersioningService#getObjectOfLatestVersion(org.apache.opencmis
- * .server. spi.CallContext, java.lang.String, java.lang.String, java.lang.Boolean,
- * java.lang.String, java.lang.Boolean, org.apache.opencmis.commons.enums.IncludeRelationships,
- * java.lang.String, java.lang.Boolean, java.lang.Boolean,
- * org.apache.opencmis.commons.api.ExtensionsData,
- * org.apache.opencmis.server.spi.ObjectInfoHolder)
- */
- public ObjectData getObjectOfLatestVersion(CallContext context, String repositoryId,
- String versionSeriesId, Boolean major, String filter, Boolean includeAllowableActions,
- IncludeRelationships includeRelationships, String renditionFilter, Boolean includePolicyIds,
- Boolean includeAcl, ExtensionsData extension, ObjectInfoHolder objectInfos) {
- return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getObject(context,
- versionSeriesId, filter, includeAllowableActions, includeAcl, objectInfos);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.opencmis.server.spi.CmisVersioningService#getPropertiesOfLatestVersion(org.apache
- * .opencmis.server .spi.CallContext, java.lang.String, java.lang.String, java.lang.Boolean,
- * java.lang.String, org.apache.opencmis.commons.api.ExtensionsData,
- * org.apache.opencmis.server.spi.ObjectInfoHolder)
- */
- public Properties getPropertiesOfLatestVersion(CallContext context, String repositoryId,
- String versionSeriesId, Boolean major, String filter, ExtensionsData extension) {
- ObjectData object = fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getObject(
- context, versionSeriesId, filter, false, false, null);
+ /**
+ * Constructor.
+ */
+ public VersioningService(RepositoryMap repositoryMap) {
+ fRepositoryMap = repositoryMap;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.opencmis.server.spi.CmisVersioningService#cancelCheckOut(org
+ * .apache.opencmis.server .spi.CallContext , java.lang.String,
+ * java.lang.String, org.apache.opencmis.commons.api.ExtensionsData)
+ */
+ public void cancelCheckOut(CallContext context, String repositoryId, String objectId, ExtensionsData extension) {
+ throw new CmisNotSupportedException("cancelCheckOut not supported!");
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.opencmis.server.spi.CmisVersioningService#checkIn(org.apache
+ * .opencmis.server.spi .CallContext, java.lang.String,
+ * org.apache.opencmis.commons.provider.Holder, java.lang.Boolean,
+ * org.apache.opencmis.commons.provider.PropertiesData,
+ * org.apache.opencmis.commons.provider.ContentStreamData, java.lang.String,
+ * java.util.List, org.apache.opencmis.commons.provider.AccessControlList,
+ * org.apache.opencmis.commons.provider.AccessControlList,
+ * org.apache.opencmis.commons.api.ExtensionsData,
+ * org.apache.opencmis.server.spi.ObjectInfoHolder)
+ */
+ public ObjectData checkIn(CallContext context, String repositoryId, Holder<String> objectId, Boolean major,
+ Properties properties, ContentStream contentStream, String checkinComment, List<String> policies,
+ Acl addAces, Acl removeAces, ExtensionsData extension, ObjectInfoHolder objectInfos) {
+ throw new CmisNotSupportedException("checkIn not supported!");
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.opencmis.server.spi.CmisVersioningService#checkOut(org.apache
+ * .opencmis.server.spi .CallContext, java.lang.String,
+ * org.apache.opencmis.commons.provider.Holder,
+ * org.apache.opencmis.commons.api.ExtensionsData,
+ * org.apache.opencmis.commons.provider.Holder,
+ * org.apache.opencmis.server.spi.ObjectInfoHolder)
+ */
+ public ObjectData checkOut(CallContext context, String repositoryId, Holder<String> objectId,
+ ExtensionsData extension, Holder<Boolean> contentCopied, ObjectInfoHolder objectInfos) {
+ throw new CmisNotSupportedException("checkOut not supported!");
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.opencmis.server.spi.CmisVersioningService#getAllVersions(org
+ * .apache.opencmis.server .spi.CallContext , java.lang.String,
+ * java.lang.String, java.lang.String, java.lang.Boolean,
+ * org.apache.opencmis.commons.api.ExtensionsData,
+ * org.apache.opencmis.server.spi.ObjectInfoHolder)
+ */
+ public List<ObjectData> getAllVersions(CallContext context, String repositoryId, String versionSeriesId,
+ String filter, Boolean includeAllowableActions, ExtensionsData extension, ObjectInfoHolder objectInfos) {
+ ObjectData theVersion = fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getObject(context,
+ versionSeriesId, filter, includeAllowableActions, false, objectInfos);
+
+ return Collections.singletonList(theVersion);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.opencmis.server.spi.CmisVersioningService#getObjectOfLatestVersion
+ * (org.apache.opencmis .server. spi.CallContext, java.lang.String,
+ * java.lang.String, java.lang.Boolean, java.lang.String, java.lang.Boolean,
+ * org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String,
+ * java.lang.Boolean, java.lang.Boolean,
+ * org.apache.opencmis.commons.api.ExtensionsData,
+ * org.apache.opencmis.server.spi.ObjectInfoHolder)
+ */
+ public ObjectData getObjectOfLatestVersion(CallContext context, String repositoryId, String versionSeriesId,
+ Boolean major, String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
+ String renditionFilter, Boolean includePolicyIds, Boolean includeAcl, ExtensionsData extension,
+ ObjectInfoHolder objectInfos) {
+ return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getObject(context, versionSeriesId,
+ filter, includeAllowableActions, includeAcl, objectInfos);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.apache.opencmis.server.spi.CmisVersioningService#
+ * getPropertiesOfLatestVersion(org.apache .opencmis.server
+ * .spi.CallContext, java.lang.String, java.lang.String, java.lang.Boolean,
+ * java.lang.String, org.apache.opencmis.commons.api.ExtensionsData,
+ * org.apache.opencmis.server.spi.ObjectInfoHolder)
+ */
+ public Properties getPropertiesOfLatestVersion(CallContext context, String repositoryId, String versionSeriesId,
+ Boolean major, String filter, ExtensionsData extension) {
+ ObjectData object = fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getObject(context,
+ versionSeriesId, filter, false, false, null);
- return object.getProperties();
- }
+ return object.getProperties();
+ }
}
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/AbstractServicesFactory.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/AbstractServicesFactory.java?rev=934896&r1=934895&r2=934896&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/AbstractServicesFactory.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/AbstractServicesFactory.java Fri Apr 16 14:14:00 2010
@@ -30,78 +30,78 @@ import org.apache.chemistry.opencmis.com
*/
public abstract class AbstractServicesFactory {
- /**
- * Initializes the factory instance.
- */
- public void init(Map<String, String> parameters) {
- }
-
- /**
- * Cleans up the the factory instance.
- */
- public void destroy() {
- }
-
- /**
- * Returns the CMIS Repository Service object.
- */
- public CmisRepositoryService getRepositoryService() {
- throw new CmisNotSupportedException("Repository Service not supported!");
- }
-
- /**
- * Returns the CMIS Navigation Service object.
- */
- public CmisNavigationService getNavigationService() {
- throw new CmisNotSupportedException("Navigation Service not supported!");
- }
-
- /**
- * Returns the CMIS Object Service object.
- */
- public CmisObjectService getObjectService() {
- throw new CmisNotSupportedException("Object Service not supported!");
- }
-
- /**
- * Returns the CMIS Versioning Service object.
- */
- public CmisVersioningService getVersioningService() {
- throw new CmisNotSupportedException("Versioning Service not supported!");
- }
-
- /**
- * Returns the CMIS Relationship Service object.
- */
- public CmisRelationshipService getRelationshipService() {
- throw new CmisNotSupportedException("Releationship Service not supported!");
- }
-
- /**
- * Returns the CMIS Discovery Service object.
- */
- public CmisDiscoveryService getDiscoveryService() {
- throw new CmisNotSupportedException("Discovery Service not supported!");
- }
-
- /**
- * Returns the CMIS MultiFiling Service object.
- */
- public CmisMultiFilingService getMultiFilingService() {
- throw new CmisNotSupportedException("MultiFiling Service not supported!");
- }
-
- /**
- * Returns the CMIS ACL Service object.
- */
- public CmisAclService getAclService() {
- throw new CmisNotSupportedException("ACL Service not supported!");
- }
-
- /**
- * Returns the CMIS Policy Service object.
- */
- public CmisPolicyService getPolicyService() {
- throw new CmisNotSupportedException("Policy Service not supported!");
- }
+ /**
+ * Initializes the factory instance.
+ */
+ public void init(Map<String, String> parameters) {
+ }
+
+ /**
+ * Cleans up the the factory instance.
+ */
+ public void destroy() {
+ }
+
+ /**
+ * Returns the CMIS Repository Service object.
+ */
+ public CmisRepositoryService getRepositoryService() {
+ throw new CmisNotSupportedException("Repository Service not supported!");
+ }
+
+ /**
+ * Returns the CMIS Navigation Service object.
+ */
+ public CmisNavigationService getNavigationService() {
+ throw new CmisNotSupportedException("Navigation Service not supported!");
+ }
+
+ /**
+ * Returns the CMIS Object Service object.
+ */
+ public CmisObjectService getObjectService() {
+ throw new CmisNotSupportedException("Object Service not supported!");
+ }
+
+ /**
+ * Returns the CMIS Versioning Service object.
+ */
+ public CmisVersioningService getVersioningService() {
+ throw new CmisNotSupportedException("Versioning Service not supported!");
+ }
+
+ /**
+ * Returns the CMIS Relationship Service object.
+ */
+ public CmisRelationshipService getRelationshipService() {
+ throw new CmisNotSupportedException("Releationship Service not supported!");
+ }
+
+ /**
+ * Returns the CMIS Discovery Service object.
+ */
+ public CmisDiscoveryService getDiscoveryService() {
+ throw new CmisNotSupportedException("Discovery Service not supported!");
+ }
+
+ /**
+ * Returns the CMIS MultiFiling Service object.
+ */
+ public CmisMultiFilingService getMultiFilingService() {
+ throw new CmisNotSupportedException("MultiFiling Service not supported!");
+ }
+
+ /**
+ * Returns the CMIS ACL Service object.
+ */
+ public CmisAclService getAclService() {
+ throw new CmisNotSupportedException("ACL Service not supported!");
+ }
+
+ /**
+ * Returns the CMIS Policy Service object.
+ */
+ public CmisPolicyService getPolicyService() {
+ throw new CmisNotSupportedException("Policy Service not supported!");
+ }
}
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CallContext.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CallContext.java?rev=934896&r1=934895&r2=934896&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CallContext.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CallContext.java Fri Apr 16 14:14:00 2010
@@ -26,42 +26,43 @@ package org.apache.chemistry.opencmis.se
*/
public interface CallContext {
- String BINDING_ATOMPUB = "atompub";
- String BINDING_WEBSERVICES = "webservices";
+ String BINDING_ATOMPUB = "atompub";
+ String BINDING_WEBSERVICES = "webservices";
- String USERNAME = "useranme";
- String PASSWORD = "password";
- String LOCALE = "locale";
- String OFFSET = "offset";
- String LENGTH = "length";
-
- /**
- * Returns the binding. Usually it returns {@link CallContext#BINDING_ATOMPUB} or
- * {@link CallContext#BINDING_WEBSERVICES}.
- */
- String getBinding();
-
- /**
- * Returns context data by key.
- *
- * @param key
- * the key
- * @return the data if the key is valid, <code>null</code> otherwise
- */
- String get(String key);
-
- /**
- * Returns the user name.
- */
- String getUsername();
-
- /**
- * Returns the password.
- */
- String getPassword();
-
- /**
- * Returns the locale.
- */
- String getLocale();
+ String USERNAME = "useranme";
+ String PASSWORD = "password";
+ String LOCALE = "locale";
+ String OFFSET = "offset";
+ String LENGTH = "length";
+
+ /**
+ * Returns the binding. Usually it returns
+ * {@link CallContext#BINDING_ATOMPUB} or
+ * {@link CallContext#BINDING_WEBSERVICES}.
+ */
+ String getBinding();
+
+ /**
+ * Returns context data by key.
+ *
+ * @param key
+ * the key
+ * @return the data if the key is valid, <code>null</code> otherwise
+ */
+ String get(String key);
+
+ /**
+ * Returns the user name.
+ */
+ String getUsername();
+
+ /**
+ * Returns the password.
+ */
+ String getPassword();
+
+ /**
+ * Returns the locale.
+ */
+ String getLocale();
}
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CmisAclService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CmisAclService.java?rev=934896&r1=934895&r2=934896&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CmisAclService.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CmisAclService.java Fri Apr 16 14:14:00 2010
@@ -23,44 +23,42 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.enums.AclPropagation;
/**
- * CMIS ACL Service interface. Please refer to the CMIS specification and the OpenCMIS documentation
- * for details.
+ * CMIS ACL Service interface. Please refer to the CMIS specification and the
+ * OpenCMIS documentation for details.
*
* @author <a href="mailto:fmueller@opentext.com">Florian Müller</a>
*
*/
public interface CmisAclService {
- /**
- * Returns the ACL of an object.
- *
- * <p>
- * Bindings: AtomPub, Web Services
- * </p>
- */
- Acl getAcl(CallContext context, String repositoryId, String objectId,
- Boolean onlyBasicPermissions, ExtensionsData extension);
+ /**
+ * Returns the ACL of an object.
+ *
+ * <p>
+ * Bindings: AtomPub, Web Services
+ * </p>
+ */
+ Acl getAcl(CallContext context, String repositoryId, String objectId, Boolean onlyBasicPermissions,
+ ExtensionsData extension);
- /**
- * Adds ACEs to and removes ACEs from the ACL of an object.
- *
- * <p>
- * Bindings: Web Services
- * </p>
- */
- Acl applyAcl(CallContext context, String repositoryId, String objectId,
- Acl addAces, Acl removeAces, AclPropagation aclPropagation,
- ExtensionsData extension);
+ /**
+ * Adds ACEs to and removes ACEs from the ACL of an object.
+ *
+ * <p>
+ * Bindings: Web Services
+ * </p>
+ */
+ Acl applyAcl(CallContext context, String repositoryId, String objectId, Acl addAces, Acl removeAces,
+ AclPropagation aclPropagation, ExtensionsData extension);
- /**
- * Applies a new ACL to an object. Since it is not possible to transmit an "add ACL" and a
- * "remove ACL" via AtomPub, the merging has to be done the client side. The ACEs provided here is
- * supposed to the new complete ACL.
- *
- * <p>
- * Bindings: AtomPub
- * </p>
- */
- Acl applyAcl(CallContext context, String repositoryId, String objectId,
- Acl aces, AclPropagation aclPropagation);
+ /**
+ * Applies a new ACL to an object. Since it is not possible to transmit an
+ * "add ACL" and a "remove ACL" via AtomPub, the merging has to be done the
+ * client side. The ACEs provided here is supposed to the new complete ACL.
+ *
+ * <p>
+ * Bindings: AtomPub
+ * </p>
+ */
+ Acl applyAcl(CallContext context, String repositoryId, String objectId, Acl aces, AclPropagation aclPropagation);
}
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CmisDiscoveryService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CmisDiscoveryService.java?rev=934896&r1=934895&r2=934896&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CmisDiscoveryService.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CmisDiscoveryService.java Fri Apr 16 14:14:00 2010
@@ -26,35 +26,33 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
/**
- * CMIS Discovery Service interface. Please refer to the CMIS specification and the OpenCMIS
- * documentation for details.
+ * CMIS Discovery Service interface. Please refer to the CMIS specification and
+ * the OpenCMIS documentation for details.
*
* @author <a href="mailto:fmueller@opentext.com">Florian Müller</a>
*
*/
public interface CmisDiscoveryService {
- /**
- * Queries the repository.
- *
- * <p>
- * Bindings: AtomPub, Web Services
- * </p>
- */
- public ObjectList query(CallContext context, String repositoryId, String statement,
- Boolean searchAllVersions, Boolean includeAllowableActions,
- IncludeRelationships includeRelationships, String renditionFilter, BigInteger maxItems,
- BigInteger skipCount, ExtensionsData extension);
+ /**
+ * Queries the repository.
+ *
+ * <p>
+ * Bindings: AtomPub, Web Services
+ * </p>
+ */
+ public ObjectList query(CallContext context, String repositoryId, String statement, Boolean searchAllVersions,
+ Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
+ BigInteger maxItems, BigInteger skipCount, ExtensionsData extension);
- /**
- * Retrieves the content changes.
- *
- * <p>
- * Bindings: AtomPub, Web Services
- * </p>
- */
- public ObjectList getContentChanges(CallContext context, String repositoryId,
- Holder<String> changeLogToken, Boolean includeProperties, String filter,
- Boolean includePolicyIds, Boolean includeAcl, BigInteger maxItems, ExtensionsData extension,
- ObjectInfoHolder objectInfos);
+ /**
+ * Retrieves the content changes.
+ *
+ * <p>
+ * Bindings: AtomPub, Web Services
+ * </p>
+ */
+ public ObjectList getContentChanges(CallContext context, String repositoryId, Holder<String> changeLogToken,
+ Boolean includeProperties, String filter, Boolean includePolicyIds, Boolean includeAcl,
+ BigInteger maxItems, ExtensionsData extension, ObjectInfoHolder objectInfos);
}
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CmisMultiFilingService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CmisMultiFilingService.java?rev=934896&r1=934895&r2=934896&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CmisMultiFilingService.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CmisMultiFilingService.java Fri Apr 16 14:14:00 2010
@@ -22,31 +22,31 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.api.ObjectData;
/**
- * CMIS MultiFiling Service interface. Please refer to the CMIS specification and the OpenCMIS
- * documentation for details.
+ * CMIS MultiFiling Service interface. Please refer to the CMIS specification
+ * and the OpenCMIS documentation for details.
*
* @author <a href="mailto:fmueller@opentext.com">Florian Müller</a>
*
*/
public interface CmisMultiFilingService {
- /**
- * Adds an object to a folder.
- *
- * <p>
- * Bindings: AtomPub, Web Services
- * </p>
- */
- ObjectData addObjectToFolder(CallContext context, String repositoryId, String objectId,
- String folderId, Boolean allVersions, ExtensionsData extension, ObjectInfoHolder objectInfos);
+ /**
+ * Adds an object to a folder.
+ *
+ * <p>
+ * Bindings: AtomPub, Web Services
+ * </p>
+ */
+ ObjectData addObjectToFolder(CallContext context, String repositoryId, String objectId, String folderId,
+ Boolean allVersions, ExtensionsData extension, ObjectInfoHolder objectInfos);
- /**
- * Removes an object to a folder.
- *
- * <p>
- * Bindings: AtomPub, Web Services
- * </p>
- */
- ObjectData removeObjectFromFolder(CallContext context, String repositoryId, String objectId,
- String folderId, ExtensionsData extension, ObjectInfoHolder objectInfos);
+ /**
+ * Removes an object to a folder.
+ *
+ * <p>
+ * Bindings: AtomPub, Web Services
+ * </p>
+ */
+ ObjectData removeObjectFromFolder(CallContext context, String repositoryId, String objectId, String folderId,
+ ExtensionsData extension, ObjectInfoHolder objectInfos);
}
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CmisNavigationService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CmisNavigationService.java?rev=934896&r1=934895&r2=934896&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CmisNavigationService.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CmisNavigationService.java Fri Apr 16 14:14:00 2010
@@ -30,82 +30,80 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
/**
- * CMIS Navigation Service interface. Please refer to the CMIS specification and the OpenCMIS
- * documentation for details.
+ * CMIS Navigation Service interface. Please refer to the CMIS specification and
+ * the OpenCMIS documentation for details.
*
* @author <a href="mailto:fmueller@opentext.com">Florian Müller</a>
*
*/
public interface CmisNavigationService {
- /**
- * Get the descendants on a folder.
- *
- * <p>
- * Bindings: AtomPub, Web Services
- * </p>
- */
- List<ObjectInFolderContainer> getDescendants(CallContext context, String repositoryId,
- String folderId, BigInteger depth, String filter, Boolean includeAllowableActions,
- IncludeRelationships includeRelationships, String renditionFilter,
- Boolean includePathSegment, ExtensionsData extension, ObjectInfoHolder objectInfos);
-
- /**
- * Get the folder tree on a folder.
- *
- * <p>
- * Bindings: AtomPub, Web Services
- * </p>
- */
- List<ObjectInFolderContainer> getFolderTree(CallContext context, String repositoryId,
- String folderId, BigInteger depth, String filter, Boolean includeAllowableActions,
- IncludeRelationships includeRelationships, String renditionFilter,
- Boolean includePathSegment, ExtensionsData extension, ObjectInfoHolder objectInfos);
-
- /**
- * Get the children on a folder.
- *
- * <p>
- * Bindings: AtomPub, Web Services
- * </p>
- */
- ObjectInFolderList getChildren(CallContext context, String repositoryId, String folderId,
- String filter, String orderBy, Boolean includeAllowableActions,
- IncludeRelationships includeRelationships, String renditionFilter,
- Boolean includePathSegment, BigInteger maxItems, BigInteger skipCount,
- ExtensionsData extension, ObjectInfoHolder objectInfos);
-
- /**
- * Gets the parent on a folder.
- *
- * <p>
- * Bindings: AtomPub, Web Services
- * </p>
- */
- ObjectData getFolderParent(CallContext context, String repositoryId, String folderId,
- String filter, ExtensionsData extension, ObjectInfoHolder objectInfos);
-
- /**
- * Gets the parents on an object.
- *
- * <p>
- * Bindings: AtomPub, Web Services
- * </p>
- */
- List<ObjectParentData> getObjectParents(CallContext context, String repositoryId,
- String objectId, String filter, Boolean includeAllowableActions,
- IncludeRelationships includeRelationships, String renditionFilter,
- Boolean includeRelativePathSegment, ExtensionsData extension, ObjectInfoHolder objectInfos);
-
- /**
- * Gets the the list of checked out documents.
- *
- * <p>
- * Bindings: AtomPub, Web Services
- * </p>
- */
- ObjectList getCheckedOutDocs(CallContext context, String repositoryId, String folderId,
- String filter, String orderBy, Boolean includeAllowableActions,
- IncludeRelationships includeRelationships, String renditionFilter, BigInteger maxItems,
- BigInteger skipCount, ExtensionsData extension, ObjectInfoHolder objectInfos);
+ /**
+ * Get the descendants on a folder.
+ *
+ * <p>
+ * Bindings: AtomPub, Web Services
+ * </p>
+ */
+ List<ObjectInFolderContainer> getDescendants(CallContext context, String repositoryId, String folderId,
+ BigInteger depth, String filter, Boolean includeAllowableActions,
+ IncludeRelationships includeRelationships, String renditionFilter, Boolean includePathSegment,
+ ExtensionsData extension, ObjectInfoHolder objectInfos);
+
+ /**
+ * Get the folder tree on a folder.
+ *
+ * <p>
+ * Bindings: AtomPub, Web Services
+ * </p>
+ */
+ List<ObjectInFolderContainer> getFolderTree(CallContext context, String repositoryId, String folderId,
+ BigInteger depth, String filter, Boolean includeAllowableActions,
+ IncludeRelationships includeRelationships, String renditionFilter, Boolean includePathSegment,
+ ExtensionsData extension, ObjectInfoHolder objectInfos);
+
+ /**
+ * Get the children on a folder.
+ *
+ * <p>
+ * Bindings: AtomPub, Web Services
+ * </p>
+ */
+ ObjectInFolderList getChildren(CallContext context, String repositoryId, String folderId, String filter,
+ String orderBy, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
+ String renditionFilter, Boolean includePathSegment, BigInteger maxItems, BigInteger skipCount,
+ ExtensionsData extension, ObjectInfoHolder objectInfos);
+
+ /**
+ * Gets the parent on a folder.
+ *
+ * <p>
+ * Bindings: AtomPub, Web Services
+ * </p>
+ */
+ ObjectData getFolderParent(CallContext context, String repositoryId, String folderId, String filter,
+ ExtensionsData extension, ObjectInfoHolder objectInfos);
+
+ /**
+ * Gets the parents on an object.
+ *
+ * <p>
+ * Bindings: AtomPub, Web Services
+ * </p>
+ */
+ List<ObjectParentData> getObjectParents(CallContext context, String repositoryId, String objectId, String filter,
+ Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
+ Boolean includeRelativePathSegment, ExtensionsData extension, ObjectInfoHolder objectInfos);
+
+ /**
+ * Gets the the list of checked out documents.
+ *
+ * <p>
+ * Bindings: AtomPub, Web Services
+ * </p>
+ */
+ ObjectList getCheckedOutDocs(CallContext context, String repositoryId, String folderId, String filter,
+ String orderBy, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
+ String renditionFilter, BigInteger maxItems, BigInteger skipCount, ExtensionsData extension,
+ ObjectInfoHolder objectInfos);
}