Commit 03b6e5ad authored by Ate Douma's avatar Ate Douma

CMS7-7081: Separate and promote all hippo services modules into standalone projects

- move and rename services-api under tmp1/trunk and rename it back to services-api/trunk hereafter
parents
* text=auto !eol
/LICENSE -text
/NOTICE -text
src/main/java/org/onehippo/cms7/services/HippoServiceException.java -text
src/main/java/org/onehippo/cms7/services/SingletonService.java -text
src/main/java/org/onehippo/cms7/services/eventbus/HippoEventListener.java -text svneol=unset#text/plain
src/main/java/org/onehippo/cms7/services/eventbus/Subscribe.java -text
src/main/java/org/onehippo/cms7/services/googleanalytics/GoogleAnalyticsService.java -text
/*.iml
/.classpath
/.project
/.settings
/target
This diff is collapsed.
Hippo CMS7 Services
Copyright 2012-2013 Hippo B.V. (http://www.onehippo.com)
This product includes software developed by:
Hippo B.V., Amsterdam, The Netherlands (http://www.onehippo.com/);
The Apache Software Foundation (http://www.apache.org/).
NOTICE: Only our own original work is licensed under the terms of the
Apache License Version 2.0. The licenses of some libraries might impose
different redistribution or general licensing terms than those stated in the
Apache License. Users and redistributors are hereby requested to verify these
conditions and agree upon them.
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2012-2013 Hippo B.V. (http://www.onehippo.com)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS"
BASIS, 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onehippo.cms7</groupId>
<artifactId>hippo-cms7-project</artifactId>
<version>21</version>
</parent>
<name>Hippo CMS7 Services</name>
<artifactId>hippo-services</artifactId>
<version>1.03.00-SNAPSHOT</version>
<inceptionYear>2012</inceptionYear>
<properties>
<!-- use root project name for all project modules NOTICE files, should be the same as in the root NOTICE file -->
<notice.project.name>Hippo CMS7 Services</notice.project.name>
<hippo.commons.version>1.02.01</hippo.commons.version>
</properties>
<scm>
<connection>scm:svn:http://svn.onehippo.org/repos/hippo/hippo-cms7/services/services-api/trunk</connection>
<developerConnection>scm:svn:https://svn.onehippo.org/repos/hippo/hippo-cms7/services/services-api/trunk</developerConnection>
<url>http://svn.onehippo.org/repos/hippo/hippo-cms7/services/services-api/trunk</url>
</scm>
<repositories>
<repository>
<id>hippo</id>
<name>Hippo Maven 2</name>
<url>http://maven.onehippo.com/maven2/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.onehippo.cms7</groupId>
<artifactId>hippo-cms7-commons</artifactId>
<version>${hippo.commons.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<id>pedantic</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.rat</groupId>
<artifactId>apache-rat-plugin</artifactId>
<inherited>false</inherited>
<configuration>
<excludes combine.children="append">
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
/*
* Copyright 2012-2013 Hippo B.V. (http://www.onehippo.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* 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.
*/
package org.onehippo.cms7.services;
public class HippoServiceException extends RuntimeException {
public HippoServiceException(String message) {
super(message);
}
public HippoServiceException(String message, Throwable cause) {
super(message, cause);
}
}
/*
* Copyright 2012-2013 Hippo B.V. (http://www.onehippo.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* 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.
*/
package org.onehippo.cms7.services;
/**
* The Service Registration represents a service with its context.
* Services that are obtained in this way, e.g. because they were registered as extensions with the whiteboard pattern,
* must be invoked with the context classloader set to the classloader in this registration object.
*/
public class HippoServiceRegistration {
private final ClassLoader classLoader;
private final Object service;
HippoServiceRegistration(final ClassLoader classLoader, final Object service) {
this.classLoader = classLoader;
this.service = service;
}
public Object getService() {
return service;
}
public ClassLoader getClassLoader() {
return classLoader;
}
}
/*
* Copyright 2012-2013 Hippo B.V. (http://www.onehippo.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* 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.
*/
package org.onehippo.cms7.services;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Singleton annotation for a service interface. When this annotation is present, a service can be registered and
* retrieved using the singleton support methods on the {@link HippoServiceRegistry}.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface SingletonService {
}
/*
* Copyright 2012-2013 Hippo B.V. (http://www.onehippo.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* 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.
*/
package org.onehippo.cms7.services;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Whiteboard annotation for a service interface. When this annotation is present, a service can be registered and
* retrieved using the singleton support methods on the {@link org.onehippo.cms7.services.HippoServiceRegistry}.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface WhiteboardService {
}
/*
* Copyright 2013 Hippo B.V. (http://www.onehippo.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* 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.
*/
package org.onehippo.cms7.services.contenttype;
import javax.jcr.RepositoryException;
import org.onehippo.cms7.services.SingletonService;
/**
* ContentType Service which provides access to:
* <ul>
* <li>A lightweight and immutable representation of the current and aggregated or effective JCR Repository NodeType definitions</li>
* <li>A lightweight and immutable representation of the current DocumentType definitions</li>
* </ul>
*
*/
@SingletonService
public interface ContentTypeService {
/**
* @return A lightweight and immutable representation of the current and aggregated or effective JCR Repository NodeType definitions
*/
EffectiveNodeTypes getEffectiveNodeTypes() throws RepositoryException;
/**
* @return A lightweight and immutable representation of the current DocumentType definitions.
*/
DocumentTypes getDocumentTypes() throws RepositoryException;
}
/*
* Copyright 2013 Hippo B.V. (http://www.onehippo.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* 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.
*/
package org.onehippo.cms7.services.contenttype;
import java.util.Map;
import java.util.Set;
/**
* An immutable Hippo Document Type representation providing a more relaxed and enhanced form of an {@link EffectiveNodeType}
* exposing only non-residual and non-duplicate named {@link DocumentTypeField} elements (of both Child Node and Property type) and with additional meta-data describing these Fields.
*/
public interface DocumentType {
/**
* @return The immutable version of the DocumentTypes instance used to create this definition
*/
long version();
/**
* @return True if there is no DocumentType definition backing this type but it only and fully is derived from the underlying EffectiveNodeType
*/
boolean isDerivedType();
/**
* @return True if this is an aggregation of multiple DocumentTypes like through a combination of DocumentTypes or JCR Node Type mixins
*/
boolean isAggregate();
/**
* @return the immutable and aggregated or effective JCR Repository {@link javax.jcr.nodetype.NodeType} representation
* which underlies this DocumentType definition
*/
EffectiveNodeType getEffectiveNodeType();
/**
* @return the Qualified name of the Document Type (see also JCR-2.0 3.2.5.2); or the list of aggregated Document Type names as [<name>,...] if {@link #isAggregate()}
* @see javax.jcr.nodetype.NodeTypeDefinition#getName()
*/
String getName();
/**
* @return The namespace prefix as used by this Document Type (derived from its name); or null if {@link #isAggregate()}
*/
String getPrefix();
/**
* @return The natural ordered set of names of all directly or inherited parent DocumentType or JCR NodeTypes for this DocumentType.
* Never null but may be empty.
* @see javax.jcr.nodetype.NodeType#getSupertypes()
*/
Set<String> getSuperTypes();
/**
* @return The natural ordered set of aggregated DocumentTypes or JCR NodeTypes mixins, at least containing {@link #getName()} even if not {@link #isAggregate()}
*/
Set<String> getAggregatedTypes();
/**
* @param documentTypeName The name of a document type
* @return True if the name of this document type or any of its {@link #getSuperTypes()} is equal to documentTypeName
* @see javax.jcr.nodetype.NodeType#isNodeType(String)
*/
boolean isDocumentType(String documentTypeName);
/**
* @return True if this DocumentType can only be used as compound within another DocumentType
*/
boolean isCompound();
/**
* @return True if this DocumentType can only be used to define a Mixin on another DocumentType
* @see javax.jcr.nodetype.NodeTypeDefinition#isMixin()
*/
boolean isMixin();
/**
* @return True if this DocumentType serves (only) as super type and/or as template for a new DocumentType (inheriting its characteristics)
*/
// TODO: check if this actually matches the purpose
boolean isTemplate();
// TODO
boolean isCascadeValidate();
/**
* @return The aggregated map of DocumentFields, keyed by their field name.
* @see javax.jcr.nodetype.NodeType#getChildNodeDefinitions()
*/
Map<String, DocumentTypeField> getFields();
}
/*
* Copyright 2013 Hippo B.V. (http://www.onehippo.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* 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.
*/
package org.onehippo.cms7.services.contenttype;
import java.util.List;
import java.util.Map;
/**
* Represents a {@link DocumentType} field element which can denote a NodeType Child or Property Definition.
* A DocumentTypeField name is always explicit, so no residual naming allowed.
* A DocumentTypeField name is unique within a DocumentType, so mixing single/multi-value properties and/or Child nodes with the same name are not allowed.
* The underlying EffectiveNodeTypeItem (Child or Property) however may be (and typically is) a residual (relaxed) property or child node.
* @see javax.jcr.nodetype.ItemDefinition
*/
public interface DocumentTypeField {
/**
* @return The qualified field name, never "*" (residual)
* @see javax.jcr.nodetype.ItemDefinition#getName()
*/
String getName();
/**
* @return A descriptive name for this Item, e.g. usable as label within an editor
*/
String getCaption();
/**
* @return The DocumentType name which defines this field, which not necessarily is the same as the containing DocumentType.
* @see javax.jcr.nodetype.ItemDefinition#getDeclaringNodeType()
*/
String getDefiningType();
/**
* @return True if this field denotes a NodeType Property, false if denotes a NodeType Child
* @see #getEffectiveNodeTypeItem()
*/
boolean isPropertyField();
/**
* @return True if there is no DocumentTypeField definition backing this field but it only and fully is derived from the underlying EffectiveNodeType Child or Property
*/
boolean isDerivedField();
/**
* Returns the type of this field, which may be a qualified name of a DocumentType (Child) or an (enhanced variant) of a NodeType property type name.
*
* For a {@link #isDerivedField()} the value from {@link #getItemType} will be returned.
*
* @return The type of this field, which may be a qualified Child DocumentType or an (enhanced variant) of a NodeType property
*/
String getFieldType();
/**
* @return The underlying {@link EffectiveNodeTypeItem#getType) for this field.
*/
String getItemType();
/**
* @return The underlying EffectiveNodeTypeItem (Child or Property) for this field
*/
EffectiveNodeTypeItem getEffectiveNodeTypeItem();
/**
* @return True if this fields denotes the primary item for the underlying EffectiveNodeType
*/
// TODO: is this (still) used?
boolean isPrimaryField();
/**
* @return True for a multi-valued Property or same-name-sibling allowing Child definition
* @see javax.jcr.nodetype.PropertyDefinition#isMultiple()
* @see javax.jcr.nodetype.NodeDefinition#allowsSameNameSiblings()
*/
boolean isMultiple();
/**
* @return True if this field is required
* @see javax.jcr.nodetype.ItemDefinition#isMandatory()
*/
boolean isMandatory();
/**
* @return True if this item is autoCreated
* @see javax.jcr.nodetype.ItemDefinition#isAutoCreated()
*/
boolean isAutoCreated();
/**
* @return True if this item is protected
* @see javax.jcr.nodetype.ItemDefinition#isProtected()
*/
boolean isProtected();
/**
* @return True if this field {@link #isMultiple()} and supports ordering of its Property values or its same-name-sibling Child items
* Note: while multi-value properties are ordered by definition, this method provides editor support for ordering prototype values or child items (if any)
*/
boolean isOrdered();
/**
* @return The list of validators for this field, may be empty but never null.
*/
List<String> getValidators();
/**
* @return The immutable map of field type specific properties, keyed on property name. The property values may be empty, single or multi-valued but never null.
* The returned map itself may be empty but never null.
*/
Map<String, List<String>> getFieldProperties();
}
/*
* Copyright 2013 Hippo B.V. (http://www.onehippo.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* 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.
*/
package org.onehippo.cms7.services.contenttype;
import java.util.Map;
import java.util.Set;
/**
* A lightweight and immutable representation of the DocumentType definitions.
* If the model is still 'current' its version property can be compared against the current version provided by the {@link org.onehippo.cms7.services.contenttype.ContentTypeService}.
*/
public interface DocumentTypes {
/**
* @return The EffectiveNodeTypes used by this DocumentTypes instance.
*/
EffectiveNodeTypes getEffectiveNodeTypes();
/**
* @return The immutable instance version which is automatically incremented for every new (changed) DocumentTypes instance created by the ContentTypeService
*/
long version();
/**
* @param name Qualified Name for a DocumentType (see JCR-2.0 3.2.5.2)
* @return The immutable DocumentType definition
*/
DocumentType getType(String name);
/**
* @return The immutable map of DocumentTypes grouped by their namespace prefix as key
*/
Map<String, Set<DocumentType>> getTypesByPrefix();
}
/*
* Copyright 2013 Hippo B.V. (http://www.onehippo.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* 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.
*/
package org.onehippo.cms7.services.contenttype;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* An immutable and aggregated or effective JCR Repository {@link javax.jcr.nodetype.NodeType} representation
* or an aggregation thereof to represent a concrete {@link javax.jcr.Node} instance.
*
* Note: not all information available from the JCR NodeType model is captured.
*/
public interface EffectiveNodeType {
/**
* @return The immutable version of the EffectiveNodeTypes instance used to create this definition
*/
long version();
/**
* @return True if this is an aggregation of multiple EffectiveNodeTypes like to represent a concrete {@link javax.jcr.Node} instance
*/
boolean isAggregate();
/**
* @return the Qualified name of the JCR Repository NodeType (see JCR-2.0 3.2.5.2); or the list of aggregated NodeType names as [<name>,...] if {@link #isAggregate()}
* @see javax.jcr.nodetype.NodeTypeDefinition#getName()
*/
String getName();
/**
* @return The namespace prefix as used by this registered NodeType (derived from its name); null if {@link #isAggregate()}
*/
String getPrefix();
/**
* @return The natural ordered set of names of all directly or inherited parent NodeTypes or mixins for this NodeType or Node.
* Never null but may be empty.
* @see javax.jcr.nodetype.NodeType#getSupertypes()
*/
Set<String> getSuperTypes();
/**
* @return The natural ordered set of aggregated EffectiveNodeTypes, at least containing {@link #getName()} even if not {@link #isAggregate()}
*/
Set<String> getAggregatedTypes();
/**
* @param nodeTypeName The name of a node type
* @return True if the name of this node type or any of its {@link #getSuperTypes()} is equal to nodeTypeName
* @see javax.jcr.nodetype.NodeType#isNodeType(String)
*/
boolean isNodeType(String nodeTypeName);
/**
* @return True if this EffectiveNodeType is marked abstract; false if {@link #isAggregate()}
* @see javax.jcr.nodetype.NodeTypeDefinition#isAbstract()
*/
boolean isAbstract();
/**
* @return True if this EffectiveNodeType represents a Mixin; false if {@link #isAggregate()}
* @see javax.jcr.nodetype.NodeTypeDefinition#isMixin()
*/
boolean isMixin();
/**
* @return True if for this aggregated or effective NodeType its child Nodes are ordered
* @see javax.jcr.nodetype.NodeTypeDefinition#hasOrderableChildNodes()
*
*/
boolean isOrdered();
/**
* @return The name of the NodeTypeItem to be used as PrimaryItem when creating a Node.
* May be null.
* @see javax.jcr.nodetype.NodeTypeDefinition#getPrimaryItemName()
*/
String getPrimaryItemName();
/**
* Returns the aggregated map of all allowable Child Node definitions.
*
* The map keys are the Qualified Child Node names, or "*" for the list of residual Child Node definitions.
* For each child 'name', possible multiple children are ordered by the number of requiredPrimaryTypes and the names thereof.
* @return The aggregated map of all allowable Child Node definitions.
* @see javax.jcr.nodetype.NodeType#getChildNodeDefinitions()
*/
Map<String, List<EffectiveNodeTypeChild>> getChildren();
/**
* Returns the aggregated map of all allowable Property definitions.
*
* The map keys are the Qualified Property names, or "*" for the list of residual Property definitions.
* For each property 'name', possible multiple properties are ordered by their type (String first) and their multiplicity (single first)
* @return The aggregated map of all allowable Property definitions.
* @see javax.jcr.nodetype.NodeType#getPropertyDefinitions()
*/
Map<String, List<EffectiveNodeTypeProperty>> getProperties();
}
/*
* Copyright 2013 Hippo B.V. (http://www.onehippo.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* 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.