Commit 05f4ab9f authored by Ard Schrijvers's avatar Ard Schrijvers

CMS7-8188 initial webservice api

parent 6f94553a
......@@ -6,3 +6,6 @@ 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
src/main/java/org/onehippo/cms7/services/webresources/Content.java -text
src/main/java/org/onehippo/cms7/services/webresources/File.java -text
src/main/java/org/onehippo/cms7/services/webresources/WebResourcesService.java -text
/*
* Copyright 2014 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.webresources;
import java.util.Calendar;
import javax.jcr.Binary;
import javax.jcr.Node;
public interface Content {
Node getNode();
String getVersion();
String getEncoding();
Calendar getLastModified();
String getMimeType();
/**
* @return returns a md5 or sha-1 kind of hash for the binary, useful for checking whether two binaries are (very likely)
* equal or for cache-busting purposes
*/
String getHash();
Binary getBinary();
}
/*
* Copyright 2014 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.webresources;
import java.util.Map;
import javax.jcr.Node;
public interface File {
/**
* @return the path to the nt:file node
*/
Node getNode();
String getFileName();
/**
* @return the jcr workspace (trunk) version
*/
Content getWorkspace();
/**
* @return the most recent checked in version
*/
Content getBase();
/**
* @param versionName the name of the version to fetch
* @return the <code>WebResource</code> for <code>versionName</code> and <code>null</code> if no such version present
*/
Content get(String versionName);
/**
* @return all versions
*/
Map<String, Content> getAll();
}
/*
* Copyright 2014 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.webresources;
import javax.jcr.Binary;
import javax.jcr.Session;
public interface WebResourcesService {
/**
* @param absPath the absolute path to the nt:file node
* @return the jcr workspace (trunk) version
*/
File get(Session session, String absPath);
// TODO checkin method
// TODO how should create work?
// boolean create(Session session, String absPath, Binary binary);
/**
* @param absPath to a jcr node of type jcr:content
* @param binary the binary to store
* @return true when the content of the nt:file node got changed as a result of this method. This might not be needed
* in case for example the MD5 of the <code>binary</code> is the same as the already present binary
*/
boolean update(Session session, String absPath, Binary binary);
/**
*
* @param session
* @param absPath
* @return
*/
boolean delete(Session session, String absPath);
/**
* @param absPath to a jcr node of type nt:file
*/
void restore(Session session, String absPath, String versionName);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment