blob: ceae8cba569e2e425e5e251c34ad6be3ff4eb32e [file] [log] [blame]
/*
* Copyright 2004-2005 The Apache Software Foundation or its licensors,
* as applicable.
*
* 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.apache.jackrabbit.decorator;
import org.apache.jackrabbit.decorator.DecoratorFactory;
import javax.jcr.query.Query;
import javax.jcr.query.QueryResult;
import javax.jcr.RepositoryException;
import javax.jcr.ItemNotFoundException;
import javax.jcr.Node;
import javax.jcr.ItemExistsException;
import javax.jcr.PathNotFoundException;
import javax.jcr.UnsupportedRepositoryOperationException;
import javax.jcr.Session;
import javax.jcr.lock.LockException;
import javax.jcr.nodetype.ConstraintViolationException;
import javax.jcr.version.VersionException;
/**
*/
public class QueryDecorator extends AbstractDecorator implements Query {
protected final Query query;
public QueryDecorator(DecoratorFactory factory, Session session, Query query) {
super(factory, session);
this.query = query;
}
/**
* @inheritDoc
*/
public QueryResult execute() throws RepositoryException {
return factory.getQueryResultDecorator(session, query.execute());
}
/**
* @inheritDoc
*/
public String getStatement() {
return query.getStatement();
}
/**
* @inheritDoc
*/
public String getLanguage() {
return query.getLanguage();
}
/**
* @inheritDoc
*/
public String getStoredQueryPath() throws ItemNotFoundException, RepositoryException {
return query.getStoredQueryPath();
}
/**
* @inheritDoc
*/
public Node storeAsNode(String absPath) throws ItemExistsException, PathNotFoundException, VersionException, ConstraintViolationException, LockException, UnsupportedRepositoryOperationException, RepositoryException {
Node node = query.storeAsNode(absPath);
return factory.getNodeDecorator(session, node);
}
}