Commit edc3229b authored by Ate Douma's avatar Ate Douma

TRIVIAL cleanup master

parent ac2cbb9a
*.project
*.classpath
*.iml
.idea/
.settings/
target/
.classpath
log4j.log
This diff is collapsed.
Hippo Configuration Management
Copyright 2016-2018 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.
The Hippo Configuration Management API module is not for public use yet.
The current API is liable to be changed in coming minor or patch releases.
\ No newline at end of file
# This is not the branch you're looking for...
BloomReach only provides the git trees for the release tags of Hippo CMS, as explained on https://www.onehippo.org/about/open-source-release-policy.html
To checkout the code for a specific release tag, after cloning this repository, use the following:
## to show the available tags
git tag
## to checkout a specific tag
git checkout <tag name>
## to modify a project
If you want to make modifications to a project, for example to create a patch, create a new fork branch from the specific tag like this:
git checkout -b forked-<tag name> <tag name>
For the latter, also see the **Build from Source** documentation at https://www.onehippo.org/library/development/build-hippo-cms-from-scratch.html
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2016-2017 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onehippo.cms</groupId>
<artifactId>hippo-configuration-management</artifactId>
<version>1.3.0-SNAPSHOT</version>
</parent>
<name>Hippo Configuration Management API</name>
<artifactId>hippo-configuration-management-api</artifactId>
<dependencies>
<dependency>
<groupId>org.onehippo.cms7</groupId>
<artifactId>hippo-services</artifactId>
</dependency>
<!-- test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
/*
* Copyright 2017-2018 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.cm;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import javax.jcr.Node;
import javax.jcr.RepositoryException;
import org.onehippo.cm.model.ConfigurationModel;
import org.onehippo.cms7.services.SingletonService;
/**
* Service providing access to the current runtime ConfigurationModel and some operations related to configuration.
*/
@SingletonService
public interface ConfigurationService {
/**
* Retrieve the current (partial) runtime ConfigurationModel This model will not contain
* content definitions, which are not stored/retained in the runtime ConfigurationModel.
*/
ConfigurationModel getRuntimeConfigurationModel();
/**
* @return Returns true if AutoExport is allowed (though perhaps currently disabled)
*/
boolean isAutoExportAvailable();
/**
* Export a JCR node, all descendants, and binary resources to a zip file.
* @param nodeToExport {@link Node}
* @return Zip {@link File} containing content with binaries. File must be deleted by caller as necessary.
*/
File exportZippedContent(Node nodeToExport) throws RepositoryException, IOException;
/**
* Export a JCR node and all descendants as text only. Note that this may be an incomplete representation if any
* included nodes have binary properties, which would normally be represented with separate resource files.
* @param nodeToExport {@link Node}
* @return Textual representation of the node and its descendants
*/
String exportContent(Node nodeToExport) throws RepositoryException, IOException;
/**
* Import a JCR node, all descendants, and binary resources into a given parent node. The input file is expected
* to match the format exported by {@link #exportZippedContent(Node)}.
* TODO: define input ZIP format
* @param zipFile zip {@link File}
* @param parentNode parent {@link Node}
*/
void importZippedContent(File zipFile, Node parentNode) throws RepositoryException, IOException;
/**
* Import a single content definition into a given parent JCR node. The inputStream should contain a YAML-formatted
* content definition as created by {@link #exportContent(Node)}.
* @param inputStream {@link InputStream} representation of yaml
* @param parentNode parent {@link Node}
*/
void importPlainYaml(final InputStream inputStream, final Node parentNode) throws RepositoryException;
}
/*
* Copyright 2017-2018 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.cm.model;
import java.io.Closeable;
import java.util.List;
import org.onehippo.cm.model.definition.ContentDefinition;
import org.onehippo.cm.model.definition.NamespaceDefinition;
import org.onehippo.cm.model.definition.WebFileBundleDefinition;
import org.onehippo.cm.model.path.JcrPath;
import org.onehippo.cm.model.tree.ConfigurationNode;
import org.onehippo.cm.model.tree.ConfigurationProperty;
/**
* Represents a combined representation of configuration data from multiple groups, projects, modules, and sources.
*/
public interface ConfigurationModel extends Closeable {
/**
* @return a List of top-level configuration groups, pre-sorted in processing order
*/
List<? extends Group> getSortedGroups();
/**
* @return a List of all namespace definitions found anywhere in the merged configuration
*/
List<? extends NamespaceDefinition> getNamespaceDefinitions();
/**
* @return a List of all content definitions found anywhere in the merged configuration
*/
List<? extends ContentDefinition> getContentDefinitions();
/**
* @return a List of all webfile bundle definitions found anywhere in the merged configuration
*/
List<? extends WebFileBundleDefinition> getWebFileBundleDefinitions();
/**
* @return the root node of the ConfigurationItem tree representing the merged state of nodes of category CONFIG
*/
ConfigurationNode getConfigurationRootNode();
/**
* Find a ConfigurationNode by its absolute path.
* @param path the path of a node
* @return a ConfigurationNode or null, if no node exists with this path
*/
ConfigurationNode resolveNode(JcrPath path);
/**
* Find a ConfigurationProperty by its absolute path.
* @param path the path of a property
* @return a ConfigurationProperty or null, if no property exists with this path
*/
ConfigurationProperty resolveProperty(JcrPath path);
/**
* @param path a JCR path
* @return the ContentDefinition defined in this model with the longest starting subpath match with path, or null if
* no content definition has a starting subpath match with its root path
*/
ContentDefinition getNearestContentDefinition(JcrPath path);
/**
* Compile cryptographic digest of contents including all referenced Modules, Sources, and resource files.
* A String.equals() comparison of this digest should be sufficient to detect changes in any config definitions,
* actions, or the root definition paths for content definitions, at minimum.
* @return a String containing a digest of model contents, in a format determined by the implementation
*/
String getDigest();
/**
* When processing of this model is complete, this method must be closed to free up resources used by
* ResourceInputProviders to access raw data streams from underlying storage.
*/
void close();
}
/*
* Copyright 2016-2018 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.cm.model;
import java.util.List;
/**
* Represents the first level of a three-level hierarchy used for managing dependency relationships between
* {@link Module}s. This is intended to equate conceptually to the level of Maven group IDs in that dependency
* management system.
*/
public interface Group extends OrderableByName {
/**
* @return The immutable list of {@link Project}s currently in this Group.
*/
List<? extends Project> getProjects();
}
/*
* Copyright 2016-2018 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.cm.model;
import java.io.File;
import java.util.Map;
import java.util.Set;
import org.onehippo.cm.model.definition.ActionItem;
import org.onehippo.cm.model.source.ConfigSource;
import org.onehippo.cm.model.source.ContentSource;
import org.onehippo.cm.model.source.ResourceInputProvider;
import org.onehippo.cm.model.source.Source;
/**
* Represents the atomic deployable unit in the Hippo Configuration Management (HCM) system. This is intended to equate
* conceptually to the level of Maven modules and artifact IDs in that dependency management system.
*/
public interface Module extends OrderableByName {
/**
* @return the full group/project/module name for this module
*/
String getFullName();
/**
* @return Returns true if this module is loaded from a zip archive (jar), otherwise false
*/
boolean isArchive();
/**
* @return Returns the {@link File} handle to the module zip archive (jar) if {@link #isArchive()}, otherwise null
*/
File getArchiveFile();
/**
* Modules are composed into Projects and Groups for purposes of expressing dependencies.
* @return the Project of which this Module is a part
*/
Project getProject();
/**
* @return The immutable set of all {@link Source}s of this module, in undefined order.
*/
Set<? extends Source> getSources();
/**
* @return The immutable set of content {@link Source}s of this module, ordered by path ({@link Source#getPath()})
* relative to the module's base resource path.
*/
Set<? extends ContentSource> getContentSources();
/**
* @return The immutable set of config {@link Source}s of this module, ordered by path ({@link Source#getPath()})
* relative to the module's base resource path.
*/
Set<? extends ConfigSource> getConfigSources();
/**
* @return A helper object to access raw streams for configuration files.
*/
ResourceInputProvider getConfigResourceInputProvider();
/**
* @return A helper object to access raw streams for content files.
*/
ResourceInputProvider getContentResourceInputProvider();
/**
* @return The immutable map of action items per version, which describe how to handle content source bootstrapping
*/
Map<String, Set<ActionItem>> getActionsMap();
/**
* @return the current "sequence number" of this module, which describes the most recent set of actions from
* {@link #getActionsMap()} that have been applied to the JCR
*/
String getLastExecutedAction();
}
/*
* Copyright 2016-2018 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.cm.model;
import java.util.Set;
/**
* Implementors of this class provide an explicit partial-ordering of their instances by specifying a name for
* themselves and a list of names of other items which must proceed them. This can then be used to produce a
* topological sorting of instances. It is expected that only "compatible" instances may be sorted together in this
* way, as defined by type compatibility with a specific implementation of this interface.
*/
public interface OrderableByName {
/**
* @return the name of this instance, which can be used by other instances in their {@link #getAfter()}
*/
String getName();
/**
* @return The <strong>ordered</strong> immutable set of {@link String}s after which
* this {@link OrderableByName} instance should be sorted.
*/
Set<String> getAfter();
}
/*
* Copyright 2016-2018 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.cm.model;
import java.util.List;
/**
* Represents the middle level of a three-level hierarchy used for managing dependency relationships between
* {@link Module}s. This is intended to equate conceptually to the level of Maven projects in that dependency
* management system.
*/
public interface Project extends OrderableByName {
/**
* @return the {@link Group} to which this Project belongs
*/
Group getGroup();
/**
* @return The immutable list of {@link Module}s currently in this Project.
*/
List<? extends Module> getModules();
}
/*
* Copyright 2017-2018 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.cm.model.definition;
import org.onehippo.cm.model.path.JcrPath;
/**
* Represents an action item, which describes a bootstrap behavior {@link ActionType} for a specific path.
*/
public interface ActionItem {
/**
* @return the JCR node path to which this action applies
*/
JcrPath getPath();
/**
* @return the {@link ActionType} that should be applied to the node at {@link #getPath()}
*/
ActionType getType();
}
/*
* Copyright 2017-2018 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.cm.model.definition;
/**
* Describes the behavior to be applied to a content source at bootstrap.
*/
public enum ActionType {
/**
* Only create new node if path does not yet exist; default behavior for content sources.
*/
APPEND,
/**
* Delete existing node and descendants, and then append.
*/
RELOAD,
/**
* Delete node and descendants, with no replacement.
*/
DELETE
}
/*
* Copyright 2016-2018 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.cm.model.definition;
import org.onehippo.cm.model.source.ConfigSource;
import org.onehippo.cm.model.source.Source;
import org.onehippo.cm.model.source.SourceType;
/**
* Represents the definition of a JCR node tree in a {@link Source} of type {@link SourceType#CONFIG}, including metadata.
* {@link #getType()} always returns {@link DefinitionType#CONFIG}.
*/
public interface ConfigDefinition<S extends ConfigSource> extends TreeDefinition<S> {
}
/*
* Copyright 2016-2018 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.cm.model.definition;
import org.onehippo.cm.model.source.ContentSource;
import org.onehippo.cm.model.source.Source;
import org.onehippo.cm.model.source.SourceType;
/**
* Represents the definition of a node tree in a {@link Source} of type {@link SourceType#CONTENT},
* with restricted metadata as compared to a {@link ConfigDefinition}.
* {@link #getType()} always returns {@link DefinitionType#CONTENT}.
*/
public interface ContentDefinition<S extends ContentSource> extends TreeDefinition<S> {
}
/*
* Copyright 2016-2018 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.cm.model.definition;
import org.onehippo.cm.model.source.Source;
/**
* Represents a definition as found in a Source.