You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by md...@apache.org on 2011/09/01 13:52:13 UTC
svn commit: r1164026 [3/11] - in
/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi:
./ config/ hierarchy/ lock/ nodetype/ observation/ operation/ query/
security/ state/ util/ version/ xml/
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java Thu Sep 1 11:52:08 2011
@@ -105,10 +105,8 @@ import org.xml.sax.SAXException;
/**
* <code>SessionImpl</code>...
*/
-public class SessionImpl extends AbstractSession
- implements NamespaceResolver, ManagerProvider {
-
- private static Logger log = LoggerFactory.getLogger(SessionImpl.class);
+public class SessionImpl extends AbstractSession implements NamespaceResolver, ManagerProvider {
+ private static final Logger log = LoggerFactory.getLogger(SessionImpl.class);
private boolean alive;
@@ -164,9 +162,11 @@ public class SessionImpl extends Abstrac
}
//--------------------------------------------------< Session interface >---
+
/**
* @see javax.jcr.Session#getRepository()
*/
+ @Override
public Repository getRepository() {
return repository;
}
@@ -174,6 +174,7 @@ public class SessionImpl extends Abstrac
/**
* @see javax.jcr.Session#getUserID()
*/
+ @Override
public String getUserID() {
return sessionInfo.getUserID();
}
@@ -183,6 +184,7 @@ public class SessionImpl extends Abstrac
*
* @see javax.jcr.Session#getAttribute(String)
*/
+ @Override
public Object getAttribute(String name) {
return null;
}
@@ -192,6 +194,7 @@ public class SessionImpl extends Abstrac
*
* @see javax.jcr.Session#getAttributeNames()
*/
+ @Override
public String[] getAttributeNames() {
return new String[0];
@@ -200,6 +203,7 @@ public class SessionImpl extends Abstrac
/**
* @see javax.jcr.Session#getWorkspace()
*/
+ @Override
public Workspace getWorkspace() {
return workspace;
}
@@ -208,7 +212,7 @@ public class SessionImpl extends Abstrac
* @see javax.jcr.Session#impersonate(Credentials)
*/
@Override
- public Session impersonate(Credentials credentials) throws LoginException, RepositoryException {
+ public Session impersonate(Credentials credentials) throws RepositoryException {
checkIsAlive();
SessionInfo info = config.getRepositoryService().impersonate(sessionInfo, credentials);
try {
@@ -226,6 +230,7 @@ public class SessionImpl extends Abstrac
/**
* @see javax.jcr.Session#getRootNode()
*/
+ @Override
public Node getRootNode() throws RepositoryException {
checkIsAlive();
@@ -236,7 +241,8 @@ public class SessionImpl extends Abstrac
/**
* @see javax.jcr.Session#getNodeByUUID(String)
*/
- public Node getNodeByUUID(String uuid) throws ItemNotFoundException, RepositoryException {
+ @Override
+ public Node getNodeByUUID(String uuid) throws RepositoryException {
// sanity check performed by getNodeById
Node node = getNodeById(getIdFactory().createNodeId(uuid));
if (node instanceof NodeImpl && ((NodeImpl)node).isNodeType(NameConstants.MIX_REFERENCEABLE)) {
@@ -261,7 +267,7 @@ public class SessionImpl extends Abstrac
* <code>Session</code> does not have permission to access the node.
* @throws RepositoryException
*/
- private Node getNodeById(NodeId id) throws ItemNotFoundException, RepositoryException {
+ private Node getNodeById(NodeId id) throws RepositoryException {
// check sanity of this session
checkIsAlive();
try {
@@ -282,7 +288,7 @@ public class SessionImpl extends Abstrac
* @see javax.jcr.Session#getItem(String)
*/
@Override
- public Item getItem(String absPath) throws PathNotFoundException, RepositoryException {
+ public Item getItem(String absPath) throws RepositoryException {
checkIsAlive();
try {
Path qPath = getQPath(absPath).getNormalizedPath();
@@ -311,7 +317,8 @@ public class SessionImpl extends Abstrac
/**
* @see javax.jcr.Session#move(String, String)
*/
- public void move(String srcAbsPath, String destAbsPath) throws ItemExistsException, PathNotFoundException, VersionException, ConstraintViolationException, LockException, RepositoryException {
+ @Override
+ public void move(String srcAbsPath, String destAbsPath) throws RepositoryException {
checkSupportedOption(Repository.LEVEL_2_SUPPORTED);
checkIsAlive();
@@ -327,7 +334,8 @@ public class SessionImpl extends Abstrac
/**
* @see javax.jcr.Session#save()
*/
- public void save() throws AccessDeniedException, ConstraintViolationException, InvalidItemStateException, VersionException, LockException, RepositoryException {
+ @Override
+ public void save() throws RepositoryException {
checkSupportedOption(Repository.LEVEL_2_SUPPORTED);
// delegate to the root node (including check for isAlive)
getRootNode().save();
@@ -336,6 +344,7 @@ public class SessionImpl extends Abstrac
/**
* @see javax.jcr.Session#refresh(boolean)
*/
+ @Override
public void refresh(boolean keepChanges) throws RepositoryException {
// delegate to the root node (including check for isAlive)
getRootNode().refresh(keepChanges);
@@ -344,6 +353,7 @@ public class SessionImpl extends Abstrac
/**
* @see javax.jcr.Session#hasPendingChanges()
*/
+ @Override
public boolean hasPendingChanges() throws RepositoryException {
checkIsAlive();
return itemStateManager.hasPendingChanges();
@@ -352,7 +362,8 @@ public class SessionImpl extends Abstrac
/**
* @see javax.jcr.Session#getValueFactory()
*/
- public ValueFactory getValueFactory() throws UnsupportedRepositoryOperationException, RepositoryException {
+ @Override
+ public ValueFactory getValueFactory() throws RepositoryException {
// must throw UnsupportedRepositoryOperationException if writing is
// not supported
checkSupportedOption(Repository.LEVEL_2_SUPPORTED);
@@ -362,6 +373,7 @@ public class SessionImpl extends Abstrac
/**
* @see javax.jcr.Session#checkPermission(String, String)
*/
+ @Override
public void checkPermission(String absPath, String actions) throws AccessControlException, RepositoryException {
if (!hasPermission(absPath, actions)) {
throw new AccessControlException("Access control violation: path = " + absPath + ", actions = " + actions);
@@ -371,7 +383,8 @@ public class SessionImpl extends Abstrac
/**
* @see Session#getImportContentHandler(String, int)
*/
- public ContentHandler getImportContentHandler(String parentAbsPath, int uuidBehavior) throws PathNotFoundException, ConstraintViolationException, VersionException, LockException, RepositoryException {
+ @Override
+ public ContentHandler getImportContentHandler(String parentAbsPath, int uuidBehavior) throws RepositoryException {
checkSupportedOption(Repository.LEVEL_2_SUPPORTED);
checkIsAlive();
@@ -379,21 +392,21 @@ public class SessionImpl extends Abstrac
// NOTE: check if path corresponds to Node and is writable is performed
// within the SessionImporter.
Importer importer = new SessionImporter(parentPath, this, itemStateManager, uuidBehavior);
- return new ImportHandler(importer, getNamespaceResolver(), workspace.getNamespaceRegistry(), getNameFactory(), getPathFactory());
+ return new ImportHandler(importer, getNamespaceResolver(), workspace.getNamespaceRegistry(), getNameFactory(),
+ getPathFactory());
}
/**
* @see javax.jcr.Session#importXML(String, java.io.InputStream, int)
*/
@Override
- public void importXML(String parentAbsPath, InputStream in, int uuidBehavior) throws IOException, PathNotFoundException, ItemExistsException, ConstraintViolationException, VersionException, InvalidSerializedDataException, LockException, RepositoryException {
+ public void importXML(String parentAbsPath, InputStream in, int uuidBehavior) throws IOException, RepositoryException {
// NOTE: checks are performed by 'getImportContentHandler'
ImportHandler handler = (ImportHandler) getImportContentHandler(parentAbsPath, uuidBehavior);
try {
SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setNamespaceAware(true);
- factory.setFeature(
- "http://xml.org/sax/features/namespace-prefixes", false);
+ factory.setFeature("http://xml.org/sax/features/namespace-prefixes", false);
SAXParser parser = factory.newSAXParser();
parser.parse(new InputSource(in), handler);
@@ -455,6 +468,7 @@ public class SessionImpl extends Abstrac
/**
* @see javax.jcr.Session#isLive()
*/
+ @Override
public boolean isLive() {
return alive;
}
@@ -462,6 +476,7 @@ public class SessionImpl extends Abstrac
/**
* @see javax.jcr.Session#addLockToken(String)
*/
+ @Override
public void addLockToken(String lt) {
try {
getLockStateManager().addLockToken(lt);
@@ -473,11 +488,12 @@ public class SessionImpl extends Abstrac
/**
* @see javax.jcr.Session#getLockTokens()
*/
+ @Override
public String[] getLockTokens() {
try {
return getLockStateManager().getLockTokens();
} catch (RepositoryException e) {
- log.warn("Unable to retrieve lock tokens for this session. (" + e.getMessage() + ")");
+ log.warn("Unable to retrieve lock tokens for this session. (" + e.getMessage() + ')');
return new String[0];
}
}
@@ -485,17 +501,19 @@ public class SessionImpl extends Abstrac
/**
* @see javax.jcr.Session#removeLockToken(String)
*/
+ @Override
public void removeLockToken(String lt) {
try {
getLockStateManager().removeLockToken(lt);
} catch (RepositoryException e) {
- log.warn("Unable to remove lock token '" +lt+ "' from this session. (" + e.getMessage() + ")");
+ log.warn("Unable to remove lock token '" +lt+ "' from this session. (" + e.getMessage() + ')');
}
}
/**
* @see Session#getAccessControlManager()
*/
+ @Override
public AccessControlManager getAccessControlManager() throws RepositoryException {
// TODO: implementation missing
throw new UnsupportedRepositoryOperationException("JCR-1104");
@@ -519,6 +537,7 @@ public class SessionImpl extends Abstrac
/**
* @see Session#getNodeByIdentifier(String)
*/
+ @Override
public Node getNodeByIdentifier(String id) throws RepositoryException {
return getNodeById(getIdFactory().fromJcrIdentifier(id));
}
@@ -541,8 +560,8 @@ public class SessionImpl extends Abstrac
/**
* @see Session#getRetentionManager()
*/
- public RetentionManager getRetentionManager()
- throws UnsupportedRepositoryOperationException, RepositoryException {
+ @Override
+ public RetentionManager getRetentionManager() throws RepositoryException {
// TODO: implementation missing
throw new UnsupportedRepositoryOperationException("JCR-1104");
}
@@ -550,8 +569,8 @@ public class SessionImpl extends Abstrac
/**
* @see Session#hasCapability(String, Object, Object[])
*/
- public boolean hasCapability(String methodName, Object target, Object[] arguments)
- throws RepositoryException {
+ @Override
+ public boolean hasCapability(String methodName, Object target, Object[] arguments) throws RepositoryException {
// most trivial implementation allowed by the specification.
return true;
}
@@ -559,6 +578,7 @@ public class SessionImpl extends Abstrac
/**
* @see Session#hasPermission(String, String)
*/
+ @Override
public boolean hasPermission(String absPath, String actions) throws RepositoryException {
checkIsAlive();
// build the array of actions to be checked
@@ -622,9 +642,8 @@ public class SessionImpl extends Abstrac
}
//--------------------------------------------------< NamespaceResolver >---
- /**
- * @see NamespaceResolver#getPrefix(String)
- */
+
+ @Override
public String getPrefix(String uri) throws NamespaceException {
try {
return getNamespacePrefix(uri);
@@ -635,9 +654,7 @@ public class SessionImpl extends Abstrac
}
}
- /**
- * @see NamespaceResolver#getURI(String)
- */
+ @Override
public String getURI(String prefix) throws NamespaceException {
try {
return getNamespaceURI(prefix);
@@ -649,6 +666,7 @@ public class SessionImpl extends Abstrac
}
//--------------------------------------< register and inform listeners >---
+
/**
* Add a <code>SessionListener</code>
*
@@ -696,108 +714,86 @@ public class SessionImpl extends Abstrac
}
//-------------------------------------------------------< init methods >---
- protected WorkspaceImpl createWorkspaceInstance(RepositoryConfig config, SessionInfo sessionInfo) throws RepositoryException {
+ protected WorkspaceImpl createWorkspaceInstance(RepositoryConfig config, SessionInfo sessionInfo)
+ throws RepositoryException {
+
return new WorkspaceImpl(sessionInfo.getWorkspaceName(), this, config, sessionInfo);
}
- protected SessionItemStateManager createSessionItemStateManager(UpdatableItemStateManager workspaceStateManager, ItemStateFactory isf) throws RepositoryException {
+ protected SessionItemStateManager createSessionItemStateManager(UpdatableItemStateManager workspaceStateManager,
+ ItemStateFactory isf) throws RepositoryException {
+
return new SessionItemStateManager(workspaceStateManager, getValidator(), getQValueFactory(), isf, this);
}
protected ItemManager createItemManager(HierarchyManager hierarchyManager) {
ItemCache cache = new ItemCacheImpl(config.getItemCacheSize());
- ItemManagerImpl imgr = new ItemManagerImpl(hierarchyManager, this, cache);
- return imgr;
+ return new ItemManagerImpl(hierarchyManager, this, cache);
}
//----------------------------------------------------< ManagerProvider >---
- /**
- * @see ManagerProvider#getNamePathResolver()
- */
+
+ @Override
public NamePathResolver getNamePathResolver() {
return npResolver;
}
- /**
- * @see ManagerProvider#getNameResolver()
- */
+ @Override
public NameResolver getNameResolver() {
return npResolver;
}
- /**
- * @see ManagerProvider#getPathResolver()
- */
+ @Override
public PathResolver getPathResolver() {
return npResolver;
}
- /**
- * @see ManagerProvider#getNamespaceResolver()
- */
+ @Override
public NamespaceResolver getNamespaceResolver() {
return this;
}
- /**
- * @see ManagerProvider#getHierarchyManager()
- */
+ @Override
public HierarchyManager getHierarchyManager() {
return workspace.getHierarchyManager();
}
- /**
- * @see ManagerProvider#getLockStateManager()
- */
+ @Override
public LockStateManager getLockStateManager() {
return workspace.getLockStateManager();
}
- /**
- * @see ManagerProvider#getAccessManager()
- */
+ @Override
public AccessManager getAccessManager() {
return workspace.getAccessManager();
}
- /**
- * @see ManagerProvider#getVersionStateManager()
- */
+ @Override
public VersionManager getVersionStateManager() {
return workspace.getVersionStateManager();
}
- /**
- * @see ManagerProvider#getItemDefinitionProvider()
- */
+ @Override
public ItemDefinitionProvider getItemDefinitionProvider() {
return workspace.getItemDefinitionProvider();
}
- /**
- * @see ManagerProvider#getNodeTypeDefinitionProvider()
- */
+ @Override
public NodeTypeDefinitionProvider getNodeTypeDefinitionProvider() {
return ntManager;
}
- /**
- * @see ManagerProvider#getEffectiveNodeTypeProvider()
- */
+ @Override
public EffectiveNodeTypeProvider getEffectiveNodeTypeProvider() {
return workspace.getEffectiveNodeTypeProvider();
}
- /**
- * @see ManagerProvider#getQValueFactory()
- */
+ @Override
public QValueFactory getQValueFactory() throws RepositoryException {
return config.getRepositoryService().getQValueFactory();
}
- /**
- * @see ManagerProvider#getJcrValueFactory()
- */
+ @Override
public ValueFactory getJcrValueFactory() throws RepositoryException {
return valueFactory;
}
@@ -848,8 +844,8 @@ public class SessionImpl extends Abstrac
}
//--------------------------------------------------------------------------
- SessionImpl switchWorkspace(String workspaceName) throws AccessDeniedException,
- NoSuchWorkspaceException, RepositoryException {
+
+ SessionImpl switchWorkspace(String workspaceName) throws RepositoryException {
checkAccessibleWorkspace(workspaceName);
SessionInfo info = config.getRepositoryService().obtain(sessionInfo, workspaceName);
@@ -908,6 +904,7 @@ public class SessionImpl extends Abstrac
return nodeState;
}
//------------------------------------------------------< check methods >---
+
/**
* Performs a sanity check on this session.
*
@@ -977,7 +974,7 @@ public class SessionImpl extends Abstrac
* @throws RepositoryException
* @see javax.jcr.Repository#getDescriptorKeys()
*/
- void checkSupportedOption(String option) throws UnsupportedRepositoryOperationException, RepositoryException {
+ void checkSupportedOption(String option) throws RepositoryException {
if (!isSupportedOption(option)) {
throw new UnsupportedRepositoryOperationException(option + " is not supported by this repository.");
}
@@ -1006,7 +1003,7 @@ public class SessionImpl extends Abstrac
* @throws NoSuchWorkspaceException
* @throws RepositoryException
*/
- void checkAccessibleWorkspace(String workspaceName) throws NoSuchWorkspaceException, RepositoryException {
+ void checkAccessibleWorkspace(String workspaceName) throws RepositoryException {
String[] wsps = workspace.getAccessibleWorkspaceNames();
boolean accessible = false;
for (int i = 0; i < wsps.length && !accessible; i++) {
@@ -1019,15 +1016,14 @@ public class SessionImpl extends Abstrac
}
//--------------------------------------------------------------------------
+
/**
* Inner class implementing the <code>IdentifierResolver</code> interface
*/
private final class IdResolver implements IdentifierResolver {
//---------------------------------------------< IdentifierResolver >---
- /**
- * @see IdentifierResolver#getPath(String)
- */
+ @Override
public Path getPath(String identifier) throws MalformedPathException {
try {
NodeId id = getIdFactory().fromJcrIdentifier(identifier);
@@ -1037,9 +1033,7 @@ public class SessionImpl extends Abstrac
}
}
- /**
- * @see IdentifierResolver#checkFormat(String)
- */
+ @Override
public void checkFormat(String identifier) throws MalformedPathException {
try {
getIdFactory().fromJcrIdentifier(identifier);
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/StaleProperty.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/StaleProperty.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/StaleProperty.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/StaleProperty.java Thu Sep 1 11:52:08 2011
@@ -39,75 +39,92 @@ import javax.jcr.version.VersionExceptio
import java.math.BigDecimal;
/**
- * This implementation of {@link Property} throws an {@link InvalidItemStateException} on
+ * This implementation of {@link javax.jcr.Property} throws an {@link InvalidItemStateException} on
* all method calls.
*/
public class StaleProperty extends AbstractProperty {
- public void setValue(Binary value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
+
+ @Override
+ public void setValue(Binary value) throws RepositoryException {
throw createIISE();
}
- public void setValue(BigDecimal value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
+ @Override
+ public void setValue(BigDecimal value) throws RepositoryException {
throw createIISE();
}
- public Value getValue() throws ValueFormatException, RepositoryException {
+ @Override
+ public Value getValue() throws RepositoryException {
throw createIISE();
}
- public Value[] getValues() throws ValueFormatException, RepositoryException {
+ @Override
+ public Value[] getValues() throws RepositoryException {
throw createIISE();
}
- public Binary getBinary() throws ValueFormatException, RepositoryException {
+ @Override
+ public Binary getBinary() throws RepositoryException {
throw createIISE();
}
- public BigDecimal getDecimal() throws ValueFormatException, RepositoryException {
+ @Override
+ public BigDecimal getDecimal() throws RepositoryException {
throw createIISE();
}
+ @Override
public PropertyDefinition getDefinition() throws RepositoryException {
throw createIISE();
}
+ @Override
public boolean isMultiple() throws RepositoryException {
throw createIISE();
}
+ @Override
public String getName() throws RepositoryException {
throw createIISE();
}
- public Node getParent() throws ItemNotFoundException, AccessDeniedException, RepositoryException {
+ @Override
+ public Node getParent() throws RepositoryException {
throw createIISE();
}
+ @Override
public Session getSession() throws RepositoryException {
throw createIISE();
}
+ @Override
public boolean isNew() {
return false;
}
+ @Override
public boolean isModified() {
return false;
}
+ @Override
public boolean isSame(Item otherItem) throws RepositoryException {
throw createIISE();
}
- public void save() throws AccessDeniedException, ItemExistsException, ConstraintViolationException, InvalidItemStateException, ReferentialIntegrityException, VersionException, LockException, NoSuchNodeTypeException, RepositoryException {
+ @Override
+ public void save() throws RepositoryException {
throw createIISE();
}
- public void refresh(boolean keepChanges) throws InvalidItemStateException, RepositoryException {
+ @Override
+ public void refresh(boolean keepChanges) throws RepositoryException {
throw createIISE();
}
- private InvalidItemStateException createIISE() {
+ private static InvalidItemStateException createIISE() {
return new InvalidItemStateException("property does not exist anymore");
}
}
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java Thu Sep 1 11:52:08 2011
@@ -84,8 +84,7 @@ import java.io.InputStream;
* <code>WorkspaceImpl</code>...
*/
public class WorkspaceImpl implements Workspace, ManagerProvider {
-
- private static Logger log = LoggerFactory.getLogger(WorkspaceImpl.class);
+ private static final Logger log = LoggerFactory.getLogger(WorkspaceImpl.class);
/**
* The name of this <code>Workspace</code>.
@@ -110,35 +109,29 @@ public class WorkspaceImpl implements Wo
private LockManager jcrLockManager;
private javax.jcr.version.VersionManager jcrVersionManager;
- public WorkspaceImpl(String name, SessionImpl session, RepositoryConfig config, SessionInfo sessionInfo) throws RepositoryException {
+ public WorkspaceImpl(String name, SessionImpl session, RepositoryConfig config, SessionInfo sessionInfo)
+ throws RepositoryException {
+
this.name = name;
this.session = session;
- wspManager = createManager(
- config.getRepositoryService(),
- sessionInfo,
- session.getCacheBehaviour(),
+ wspManager = createManager(config.getRepositoryService(), sessionInfo, session.getCacheBehaviour(),
session.getPollTimeout());
}
//----------------------------------------------------------< Workspace >---
- /**
- * @see javax.jcr.Workspace#getSession()
- */
+
+ @Override
public Session getSession() {
return session;
}
- /**
- * @see javax.jcr.Workspace#getName()
- */
+ @Override
public String getName() {
return name;
}
- /**
- * @see javax.jcr.Workspace#copy(String, String)
- */
- public void copy(String srcAbsPath, String destAbsPath) throws ConstraintViolationException, VersionException, AccessDeniedException, PathNotFoundException, ItemExistsException, LockException, RepositoryException {
+ @Override
+ public void copy(String srcAbsPath, String destAbsPath) throws RepositoryException {
session.checkSupportedOption(Repository.LEVEL_2_SUPPORTED);
session.checkIsAlive();
@@ -150,10 +143,8 @@ public class WorkspaceImpl implements Wo
getUpdatableItemStateManager().execute(op);
}
- /**
- * @see javax.jcr.Workspace#copy(String, String, String)
- */
- public void copy(String srcWorkspace, String srcAbsPath, String destAbsPath) throws NoSuchWorkspaceException, ConstraintViolationException, VersionException, AccessDeniedException, PathNotFoundException, ItemExistsException, LockException, RepositoryException {
+ @Override
+ public void copy(String srcWorkspace, String srcAbsPath, String destAbsPath) throws RepositoryException {
session.checkSupportedOption(Repository.LEVEL_2_SUPPORTED);
session.checkIsAlive();
@@ -190,10 +181,10 @@ public class WorkspaceImpl implements Wo
}
}
- /**
- * @see javax.jcr.Workspace#clone(String, String, String, boolean)
- */
- public void clone(String srcWorkspace, String srcAbsPath, String destAbsPath, boolean removeExisting) throws NoSuchWorkspaceException, ConstraintViolationException, VersionException, AccessDeniedException, PathNotFoundException, ItemExistsException, LockException, RepositoryException {
+ @Override
+ public void clone(String srcWorkspace, String srcAbsPath, String destAbsPath, boolean removeExisting)
+ throws RepositoryException {
+
session.checkSupportedOption(Repository.LEVEL_2_SUPPORTED);
session.checkIsAlive();
@@ -232,10 +223,8 @@ public class WorkspaceImpl implements Wo
}
}
- /**
- * @see javax.jcr.Workspace#move(String, String)
- */
- public void move(String srcAbsPath, String destAbsPath) throws ConstraintViolationException, VersionException, AccessDeniedException, PathNotFoundException, ItemExistsException, LockException, RepositoryException {
+ @Override
+ public void move(String srcAbsPath, String destAbsPath) throws RepositoryException {
session.checkSupportedOption(Repository.LEVEL_2_SUPPORTED);
session.checkIsAlive();
@@ -246,16 +235,12 @@ public class WorkspaceImpl implements Wo
getUpdatableItemStateManager().execute(op);
}
- /**
- * @see javax.jcr.Workspace#restore(Version[], boolean)
- */
- public void restore(Version[] versions, boolean removeExisting) throws ItemExistsException, UnsupportedRepositoryOperationException, VersionException, LockException, InvalidItemStateException, RepositoryException {
+ @Override
+ public void restore(Version[] versions, boolean removeExisting) throws RepositoryException {
getVersionManager().restore(versions, removeExisting);
}
- /**
- * @see javax.jcr.Workspace#getQueryManager()
- */
+ @Override
public QueryManager getQueryManager() throws RepositoryException {
session.checkIsAlive();
if (qManager == null) {
@@ -265,26 +250,20 @@ public class WorkspaceImpl implements Wo
return qManager;
}
- /**
- * @see javax.jcr.Workspace#getNamespaceRegistry()
- */
+ @Override
public NamespaceRegistry getNamespaceRegistry() throws RepositoryException {
session.checkIsAlive();
return wspManager.getNamespaceRegistryImpl();
}
- /**
- * @see javax.jcr.Workspace#getNodeTypeManager()
- */
+ @Override
public NodeTypeManager getNodeTypeManager() throws RepositoryException {
session.checkIsAlive();
return session.getNodeTypeManager();
}
- /**
- * @see javax.jcr.Workspace#getObservationManager()
- */
- public ObservationManager getObservationManager() throws UnsupportedRepositoryOperationException, RepositoryException {
+ @Override
+ public ObservationManager getObservationManager() throws RepositoryException {
session.checkSupportedOption(Repository.OPTION_OBSERVATION_SUPPORTED);
session.checkIsAlive();
@@ -294,21 +273,14 @@ public class WorkspaceImpl implements Wo
return obsManager;
}
- /**
- * @see javax.jcr.Workspace#getAccessibleWorkspaceNames()
- */
+ @Override
public String[] getAccessibleWorkspaceNames() throws RepositoryException {
session.checkIsAlive();
return wspManager.getWorkspaceNames();
}
- /**
- * @see javax.jcr.Workspace#getImportContentHandler(String, int)
- */
- public ContentHandler getImportContentHandler(String parentAbsPath, int uuidBehavior)
- throws PathNotFoundException, ConstraintViolationException, VersionException,
- LockException, RepositoryException {
-
+ @Override
+ public ContentHandler getImportContentHandler(String parentAbsPath, int uuidBehavior) throws RepositoryException {
session.checkSupportedOption(Repository.LEVEL_2_SUPPORTED);
session.checkIsAlive();
@@ -323,14 +295,8 @@ public class WorkspaceImpl implements Wo
return new WorkspaceContentHandler(this, parentAbsPath, uuidBehavior);
}
- /**
- * @see javax.jcr.Workspace#importXML(String, InputStream, int)
- */
- public void importXML(String parentAbsPath, InputStream in, int uuidBehavior)
- throws IOException, PathNotFoundException, ItemExistsException,
- ConstraintViolationException, InvalidSerializedDataException,
- LockException, RepositoryException {
-
+ @Override
+ public void importXML(String parentAbsPath, InputStream in, int uuidBehavior) throws IOException, RepositoryException {
session.checkSupportedOption(Repository.LEVEL_2_SUPPORTED);
session.checkIsAlive();
@@ -349,9 +315,7 @@ public class WorkspaceImpl implements Wo
}
}
- /**
- * @see javax.jcr.Workspace#createWorkspace(String)
- */
+ @Override
public void createWorkspace(String name) throws RepositoryException {
session.checkIsAlive();
session.checkSupportedOption(Repository.OPTION_WORKSPACE_MANAGEMENT_SUPPORTED);
@@ -359,9 +323,7 @@ public class WorkspaceImpl implements Wo
}
- /**
- * @see javax.jcr.Workspace#createWorkspace(String, String)
- */
+ @Override
public void createWorkspace(String name, String srcWorkspace) throws RepositoryException {
session.checkIsAlive();
session.checkSupportedOption(Repository.OPTION_WORKSPACE_MANAGEMENT_SUPPORTED);
@@ -369,9 +331,7 @@ public class WorkspaceImpl implements Wo
}
- /**
- * @see javax.jcr.Workspace#deleteWorkspace(String)
- */
+ @Override
public void deleteWorkspace(String name) throws RepositoryException {
session.checkIsAlive();
session.checkSupportedOption(Repository.OPTION_WORKSPACE_MANAGEMENT_SUPPORTED);
@@ -379,9 +339,7 @@ public class WorkspaceImpl implements Wo
}
- /**
- * @see javax.jcr.Workspace#getLockManager()
- */
+ @Override
public LockManager getLockManager() throws RepositoryException {
session.checkIsAlive();
session.checkSupportedOption(Repository.OPTION_LOCKING_SUPPORTED);
@@ -391,11 +349,8 @@ public class WorkspaceImpl implements Wo
return jcrLockManager;
}
- /**
- * @see javax.jcr.Workspace#getVersionManager()
- */
- public synchronized javax.jcr.version.VersionManager getVersionManager()
- throws RepositoryException {
+ @Override
+ public synchronized javax.jcr.version.VersionManager getVersionManager() throws RepositoryException {
session.checkIsAlive();
session.checkSupportedOption(Repository.OPTION_VERSIONING_SUPPORTED);
if (jcrVersionManager == null) {
@@ -405,51 +360,38 @@ public class WorkspaceImpl implements Wo
}
//----------------------------------------------------< ManagerProvider >---
- /**
- * @see ManagerProvider#getNamePathResolver()
- */
+
+ @Override
public org.apache.jackrabbit.spi.commons.conversion.NamePathResolver getNamePathResolver() {
return session.getNamePathResolver();
}
- /**
- * @see ManagerProvider#getNameResolver()
- */
+ @Override
public NameResolver getNameResolver() {
return session.getNameResolver();
}
- /**
- * @see ManagerProvider#getPathResolver()
- */
+ @Override
public PathResolver getPathResolver() {
return session.getPathResolver();
}
- /**
- * @see ManagerProvider#getNamespaceResolver()
- */
+ @Override
public NamespaceResolver getNamespaceResolver() {
return session.getNamespaceResolver();
}
- /**
- * @see ManagerProvider#getHierarchyManager()
- */
+ @Override
public HierarchyManager getHierarchyManager() {
return wspManager.getHierarchyManager();
}
- /**
- * @see ManagerProvider#getAccessManager()
- */
+ @Override
public AccessManager getAccessManager() {
return wspManager;
}
- /**
- * @see ManagerProvider#getLockStateManager()
- */
+ @Override
public LockStateManager getLockStateManager() {
if (lockManager == null) {
lockManager = createLockManager(wspManager, session.getItemManager());
@@ -457,9 +399,7 @@ public class WorkspaceImpl implements Wo
return lockManager;
}
- /**
- * @see ManagerProvider#getVersionStateManager()
- */
+ @Override
public VersionManager getVersionStateManager() {
if (versionManager == null) {
versionManager = createVersionManager(wspManager);
@@ -467,42 +407,33 @@ public class WorkspaceImpl implements Wo
return versionManager;
}
- /**
- * @see ManagerProvider#getItemDefinitionProvider()
- */
+ @Override
public ItemDefinitionProvider getItemDefinitionProvider() {
return wspManager.getItemDefinitionProvider();
}
- /**
- * @see ManagerProvider#getNodeTypeDefinitionProvider()
- */
+ @Override
public NodeTypeDefinitionProvider getNodeTypeDefinitionProvider() {
return session.getNodeTypeManager();
}
- /**
- * @see ManagerProvider#getEffectiveNodeTypeProvider()
- */
+ @Override
public EffectiveNodeTypeProvider getEffectiveNodeTypeProvider() {
return wspManager.getEffectiveNodeTypeProvider();
}
- /**
- * @see ManagerProvider#getJcrValueFactory()
- */
+ @Override
public ValueFactory getJcrValueFactory() throws RepositoryException {
return session.getJcrValueFactory();
}
- /**
- * @see ManagerProvider#getQValueFactory()
- */
+ @Override
public QValueFactory getQValueFactory() throws RepositoryException {
return session.getQValueFactory();
}
//------------------------------------< implementation specific methods >---
+
void dispose() {
// NOTE: wspManager has already been disposed upon SessionItemStateManager.dispose()
}
@@ -547,6 +478,7 @@ public class WorkspaceImpl implements Wo
}
//-----------------------------------------------------< initialization >---
+
/**
* Create the workspace state manager. May be overridden by subclasses.
*
@@ -557,10 +489,9 @@ public class WorkspaceImpl implements Wo
* @return state manager
* @throws javax.jcr.RepositoryException If an error occurs
*/
- protected WorkspaceManager createManager(RepositoryService service,
- SessionInfo sessionInfo,
- CacheBehaviour cacheBehaviour,
- int pollTimeout) throws RepositoryException {
+ protected WorkspaceManager createManager(RepositoryService service, SessionInfo sessionInfo,
+ CacheBehaviour cacheBehaviour, int pollTimeout) throws RepositoryException {
+
return new WorkspaceManager(service, sessionInfo, cacheBehaviour,
pollTimeout, session.isSupportedOption(Repository.OPTION_OBSERVATION_SUPPORTED));
}
@@ -584,7 +515,7 @@ public class WorkspaceImpl implements Wo
* @param wspManager the workspace manager.
* @return a new <code>VersionManager</code> instance.
*/
- protected VersionManager createVersionManager(WorkspaceManager wspManager) {
+ protected static VersionManager createVersionManager(WorkspaceManager wspManager) {
return new VersionManagerImpl(wspManager);
}
@@ -596,7 +527,9 @@ public class WorkspaceImpl implements Wo
* @return a new <code>ObservationManager</code> instance
* @throws RepositoryException If an error occurs.
*/
- protected ObservationManager createObservationManager(NamePathResolver resolver, NodeTypeRegistry ntRegistry) throws RepositoryException {
+ protected ObservationManager createObservationManager(NamePathResolver resolver, NodeTypeRegistry ntRegistry)
+ throws RepositoryException {
+
return new ObservationManagerImpl(wspManager, resolver, ntRegistry);
}
}
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java Thu Sep 1 11:52:08 2011
@@ -119,10 +119,8 @@ import org.slf4j.LoggerFactory;
/**
* <code>WorkspaceManager</code>...
*/
-public class WorkspaceManager
- implements UpdatableItemStateManager, NamespaceStorage, AccessManager {
-
- private static Logger log = LoggerFactory.getLogger(WorkspaceManager.class);
+public class WorkspaceManager implements UpdatableItemStateManager, NamespaceStorage, AccessManager {
+ private static final Logger log = LoggerFactory.getLogger(WorkspaceManager.class);
private final RepositoryService service;
private final SessionInfo sessionInfo;
@@ -159,7 +157,7 @@ public class WorkspaceManager
/**
* Flag that indicates that the changeFeed thread should be disposed.
*/
- private volatile boolean disposeChangeFeed = false;
+ private volatile boolean disposeChangeFeed;
/**
* List of event listener that are set on this WorkspaceManager to get
@@ -177,10 +175,8 @@ public class WorkspaceManager
*/
private ItemInfoCache cache;
- public WorkspaceManager(RepositoryService service, SessionInfo sessionInfo,
- CacheBehaviour cacheBehaviour, int pollTimeout,
- boolean observationSupported)
- throws RepositoryException {
+ public WorkspaceManager(RepositoryService service, SessionInfo sessionInfo, CacheBehaviour cacheBehaviour,
+ int pollTimeout, boolean observationSupported) throws RepositoryException {
this.service = service;
this.sessionInfo = sessionInfo;
@@ -188,8 +184,8 @@ public class WorkspaceManager
this.observationSupported = observationSupported;
this.pollTimeout = pollTimeout;
- this.nameFactory = service.getNameFactory();
- this.pathFactory = service.getPathFactory();
+ nameFactory = service.getNameFactory();
+ pathFactory = service.getPathFactory();
idFactory = service.getIdFactory();
nsRegistry = new NamespaceRegistryImpl(this);
@@ -197,8 +193,8 @@ public class WorkspaceManager
definitionProvider = createDefinitionProvider(getEffectiveNodeTypeProvider());
TransientItemStateFactory stateFactory = createItemStateFactory();
- this.isf = stateFactory;
- this.hierarchyManager = createHierarchyManager(stateFactory, idFactory);
+ isf = stateFactory;
+ hierarchyManager = createHierarchyManager(stateFactory, idFactory);
// If cache behavior is observation register a hierarchy listener which is
// notified about all changes. Otherwise just add a hierarchy listener which
@@ -265,7 +261,7 @@ public class WorkspaceManager
* @throws RepositoryException If another error occurs.
* @see org.apache.jackrabbit.spi.SessionInfo#getLockTokens()
*/
- public String[] getLockTokens() throws UnsupportedRepositoryOperationException, RepositoryException {
+ public String[] getLockTokens() throws RepositoryException {
return sessionInfo.getLockTokens();
}
@@ -279,7 +275,7 @@ public class WorkspaceManager
* @throws RepositoryException If another exception occurs.
* @see SessionInfo#addLockToken(String)
*/
- public void addLockToken(String lt) throws UnsupportedRepositoryOperationException, LockException, RepositoryException {
+ public void addLockToken(String lt) throws RepositoryException {
sessionInfo.addLockToken(lt);
}
@@ -293,7 +289,7 @@ public class WorkspaceManager
* @throws RepositoryException If another exception occurs.
* @see SessionInfo#removeLockToken(String)
*/
- public void removeLockToken(String lt) throws UnsupportedRepositoryOperationException, LockException, RepositoryException {
+ public void removeLockToken(String lt) throws RepositoryException {
for (String token : sessionInfo.getLockTokens()) {
if (token.equals(lt)) {
sessionInfo.removeLockToken(lt);
@@ -302,7 +298,7 @@ public class WorkspaceManager
}
// sessionInfo doesn't contain the given lock token and is therefore
// not the lock holder
- throw new LockException("Unable to remove locktoken '" + lt + "' from Session.");
+ throw new LockException("Unable to remove lock token '" + lt + "' from Session.");
}
/**
@@ -326,10 +322,9 @@ public class WorkspaceManager
* @throws RepositoryException if an error occurs while checking the query
* statement.
*/
- public String[] checkQueryStatement(String statement,
- String language,
- Map<String, String> namespaces)
- throws InvalidQueryException, RepositoryException {
+ public String[] checkQueryStatement(String statement, String language, Map<String, String> namespaces)
+ throws RepositoryException {
+
return service.checkQueryStatement(sessionInfo, statement, language, namespaces);
}
@@ -344,8 +339,9 @@ public class WorkspaceManager
* @return the QueryInfo created by {@link RepositoryService#executeQuery(org.apache.jackrabbit.spi.SessionInfo, String, String, java.util.Map, long, long, java.util.Map)}.
* @throws RepositoryException If an error occurs.
*/
- public QueryInfo executeQuery(String statement, String language, Map<String, String> namespaces,
- long limit, long offset, Map<String, QValue> boundValues) throws RepositoryException {
+ public QueryInfo executeQuery(String statement, String language, Map<String, String> namespaces, long limit,
+ long offset, Map<String, QValue> boundValues) throws RepositoryException {
+
return service.executeQuery(sessionInfo, statement, language, namespaces, limit, offset, boundValues);
}
@@ -408,7 +404,7 @@ public class WorkspaceManager
* javax.jcr.observation.ObservationManager#addEventListener}.
*
* @param eventTypes A combination of one or more event type constants
- * encoded as a bitmask.
+ * encoded as a bit mask.
* @param path an absolute path.
* @param isDeep a <code>boolean</code>.
* @param uuids array of UUIDs.
@@ -418,10 +414,9 @@ public class WorkspaceManager
* @throws UnsupportedRepositoryOperationException
* if this implementation does not support observation.
*/
- public EventFilter createEventFilter(int eventTypes, Path path, boolean isDeep,
- String[] uuids, Name[] nodeTypes,
- boolean noLocal)
- throws UnsupportedRepositoryOperationException, RepositoryException {
+ public EventFilter createEventFilter(int eventTypes, Path path, boolean isDeep, String[] uuids, Name[] nodeTypes,
+ boolean noLocal) throws RepositoryException {
+
return service.createEventFilter(sessionInfo, eventTypes, path, isDeep, uuids, nodeTypes, noLocal);
}
@@ -436,8 +431,7 @@ public class WorkspaceManager
* if the implementation does not support
* journaled observation.
*/
- public EventBundle getEvents(EventFilter filter, long after)
- throws RepositoryException, UnsupportedRepositoryOperationException {
+ public EventBundle getEvents(EventFilter filter, long after) throws RepositoryException {
return service.getEvents(sessionInfo, filter, after);
}
@@ -474,8 +468,7 @@ public class WorkspaceManager
WorkspaceItemStateFactory isf = new WorkspaceItemStateFactory(service, sessionInfo,
getItemDefinitionProvider(), cache);
- TransientItemStateFactory tisf = new TransientISFactory(isf, getItemDefinitionProvider());
- return tisf;
+ return new TransientISFactory(isf, getItemDefinitionProvider());
}
/**
@@ -484,7 +477,7 @@ public class WorkspaceManager
* @return a new instance of <code>HierarchyManager</code>.
* @throws javax.jcr.RepositoryException If an error occurs.
*/
- private HierarchyManager createHierarchyManager(TransientItemStateFactory tisf, IdFactory idFactory) throws RepositoryException {
+ private HierarchyManager createHierarchyManager(TransientItemStateFactory tisf, IdFactory idFactory) {
return new HierarchyManagerImpl(tisf, idFactory, getPathFactory());
}
@@ -493,8 +486,7 @@ public class WorkspaceManager
* @return a new InternalEventListener
*/
private InternalEventListener createHierarchyListener(HierarchyManager hierarchyMgr) {
- InternalEventListener listener = new HierarchyEventListener(this, hierarchyMgr, cacheBehaviour);
- return listener;
+ return new HierarchyEventListener(this, hierarchyMgr, cacheBehaviour);
}
/**
@@ -503,16 +495,20 @@ public class WorkspaceManager
*/
private NodeTypeRegistryImpl createNodeTypeRegistry(NamespaceRegistry nsRegistry) {
NodeTypeStorage ntst = new NodeTypeStorage() {
+ @Override
public Iterator<QNodeTypeDefinition> getAllDefinitions() throws RepositoryException {
return service.getQNodeTypeDefinitions(sessionInfo);
}
- public Iterator<QNodeTypeDefinition> getDefinitions(Name[] nodeTypeNames) throws NoSuchNodeTypeException, RepositoryException {
+ @Override
+ public Iterator<QNodeTypeDefinition> getDefinitions(Name[] nodeTypeNames) throws RepositoryException {
return service.getQNodeTypeDefinitions(sessionInfo, nodeTypeNames);
}
+ @Override
public void registerNodeTypes(QNodeTypeDefinition[] nodeTypeDefs, boolean allowUpdate) throws RepositoryException {
service.registerNodeTypes(sessionInfo, nodeTypeDefs, allowUpdate);
}
- public void unregisterNodeTypes(Name[] nodeTypeNames) throws NoSuchNodeTypeException, RepositoryException {
+ @Override
+ public void unregisterNodeTypes(Name[] nodeTypeNames) throws RepositoryException {
service.unregisterNodeTypes(sessionInfo, nodeTypeNames);
}
};
@@ -550,10 +546,11 @@ public class WorkspaceManager
}
//-----------------------------------------------------< wsp management >---
+
/**
* Create a new workspace with the specified <code>name</code>. If
* <code>srcWorkspaceName</code> isn't <code>null</code> the content of
- * that workspace is used as inital content, otherwise an empty workspace
+ * that workspace is used as initial content, otherwise an empty workspace
* will be created.
*
* @param name The name of the workspace to be created.
@@ -576,11 +573,11 @@ public class WorkspaceManager
}
//------------------------------------------< UpdatableItemStateManager >---
+
/**
* Creates a new batch from the single workspace operation and executes it.
- *
- * @see UpdatableItemStateManager#execute(Operation)
*/
+ @Override
public void execute(Operation operation) throws RepositoryException {
// block event delivery while changes are executed
try {
@@ -589,13 +586,9 @@ public class WorkspaceManager
throw new RepositoryException(e);
}
try {
- /*
- Execute operation and delegate invalidation of affected item
- states to the operation.
- NOTE, that the invalidation is independent of the cache behaviour
- due to the fact, that local event bundles are not processed by
- the HierarchyEventListener.
- */
+ // Execute operation and delegate invalidation of affected item states to the operation.
+ // NOTE, that the invalidation is independent of the cache behaviour due to the fact,
+ // that local event bundles are not processed by the HierarchyEventListener.
new OperationVisitorImpl(sessionInfo).execute(operation);
operation.persisted();
} finally {
@@ -609,6 +602,7 @@ public class WorkspaceManager
* @param changes The set of transient changes to be executed.
* @throws RepositoryException
*/
+ @Override
public void execute(ChangeLog changes) throws RepositoryException {
// block event delivery while changes are executed
try {
@@ -627,6 +621,7 @@ public class WorkspaceManager
/**
* Dispose this <code>WorkspaceManager</code>
*/
+ @Override
public synchronized void dispose() {
try {
updateSync.acquire();
@@ -655,11 +650,10 @@ public class WorkspaceManager
}
//------------------------------------------------------< AccessManager >---
- /**
- * @see AccessManager#isGranted(NodeState, Path, String[])
- */
+
+ @Override
public boolean isGranted(NodeState parentState, Path relPath, String[] actions)
- throws ItemNotFoundException, RepositoryException {
+ throws RepositoryException {
if (parentState.getStatus() == Status.NEW) {
return true;
}
@@ -673,43 +667,28 @@ public class WorkspaceManager
return service.isGranted(sessionInfo, id, actions);
}
- /**
- * @see AccessManager#isGranted(ItemState, String[])
- */
- public boolean isGranted(ItemState itemState, String[] actions) throws ItemNotFoundException, RepositoryException {
+ @Override
+ public boolean isGranted(ItemState itemState, String[] actions) throws RepositoryException {
// a 'new' state can always be read, written and removed
- if (itemState.getStatus() == Status.NEW) {
- return true;
- }
- return service.isGranted(sessionInfo, itemState.getWorkspaceId(), actions);
+ return itemState.getStatus() == Status.NEW || service.isGranted(sessionInfo, itemState.getWorkspaceId(), actions);
}
- /**
- * @see AccessManager#canRead(ItemState)
- */
- public boolean canRead(ItemState itemState) throws ItemNotFoundException, RepositoryException {
+ @Override
+ public boolean canRead(ItemState itemState) throws RepositoryException {
// a 'new' state can always be read
- if (itemState.getStatus() == Status.NEW) {
- return true;
- }
- return service.isGranted(sessionInfo, itemState.getWorkspaceId(), AccessManager.READ);
+ return itemState.getStatus() == Status.NEW || service.isGranted(sessionInfo, itemState.getWorkspaceId(),
+ AccessManager.READ);
}
- /**
- * @see AccessManager#canRemove(ItemState)
- */
- public boolean canRemove(ItemState itemState) throws ItemNotFoundException, RepositoryException {
+ @Override
+ public boolean canRemove(ItemState itemState) throws RepositoryException {
// a 'new' state can always be removed again
- if (itemState.getStatus() == Status.NEW) {
- return true;
- }
- return service.isGranted(sessionInfo, itemState.getWorkspaceId(), AccessManager.REMOVE);
+ return itemState.getStatus() == Status.NEW || service.isGranted(sessionInfo, itemState.getWorkspaceId(),
+ AccessManager.REMOVE);
}
- /**
- * @see AccessManager#canAccess(String)
- */
- public boolean canAccess(String workspaceName) throws NoSuchWorkspaceException, RepositoryException {
+ @Override
+ public boolean canAccess(String workspaceName) throws RepositoryException {
for (String wspName : getWorkspaceNames()) {
if (wspName.equals(workspaceName)) {
return true;
@@ -720,29 +699,35 @@ public class WorkspaceManager
//---------------------------------------------------< NamespaceStorage >---
+ @Override
public Map<String, String> getRegisteredNamespaces() throws RepositoryException {
return service.getRegisteredNamespaces(sessionInfo);
}
- public String getPrefix(String uri) throws NamespaceException, RepositoryException {
+ @Override
+ public String getPrefix(String uri) throws RepositoryException {
return service.getNamespacePrefix(sessionInfo, uri);
}
- public String getURI(String prefix) throws NamespaceException, RepositoryException {
+ @Override
+ public String getURI(String prefix) throws RepositoryException {
return service.getNamespaceURI(sessionInfo, prefix);
}
- public void registerNamespace(String prefix, String uri) throws NamespaceException, UnsupportedRepositoryOperationException, AccessDeniedException, RepositoryException {
+ @Override
+ public void registerNamespace(String prefix, String uri) throws RepositoryException {
service.registerNamespace(sessionInfo, prefix, uri);
}
- public void unregisterNamespace(String uri) throws NamespaceException, UnsupportedRepositoryOperationException, AccessDeniedException, RepositoryException {
+ @Override
+ public void unregisterNamespace(String uri) throws RepositoryException {
service.unregisterNamespace(sessionInfo, uri);
}
//--------------------------------------------------------------------------
+
/**
- * Called when local or external events occured. This method is called after
+ * Called when local or external events occurred. This method is called after
* changes have been applied to the repository.
*
* @param eventBundles the event bundles generated by the repository service
@@ -751,9 +736,7 @@ public class WorkspaceManager
* @throws InterruptedException if this thread is interrupted while waiting
* for the {@link #updateSync}.
*/
- private void onEventReceived(EventBundle[] eventBundles,
- InternalEventListener[] lstnrs)
- throws InterruptedException {
+ private void onEventReceived(EventBundle[] eventBundles, InternalEventListener[] lstnrs) throws InterruptedException {
if (log.isDebugEnabled()) {
log.debug("received {} event bundles.", eventBundles.length);
for (EventBundle eventBundle : eventBundles) {
@@ -830,7 +813,7 @@ public class WorkspaceManager
/**
* Executes the operations on the repository service.
*
- * @param changeLog The changelog to be executed
+ * @param changeLog The change log to be executed
* @throws javax.jcr.AccessDeniedException
* @throws javax.jcr.ItemExistsException
* @throws javax.jcr.UnsupportedRepositoryOperationException
@@ -838,7 +821,7 @@ public class WorkspaceManager
* @throws javax.jcr.nodetype.NoSuchNodeTypeException
* @throws javax.jcr.version.VersionException
*/
- private void execute(ChangeLog changeLog) throws RepositoryException, ConstraintViolationException, AccessDeniedException, ItemExistsException, NoSuchNodeTypeException, UnsupportedRepositoryOperationException, VersionException {
+ private void execute(ChangeLog changeLog) throws RepositoryException {
RepositoryException ex = null;
try {
ItemState target = changeLog.getTarget();
@@ -883,23 +866,20 @@ public class WorkspaceManager
* @throws javax.jcr.nodetype.NoSuchNodeTypeException
* @throws javax.jcr.version.VersionException
*/
- private void execute(Operation workspaceOperation) throws RepositoryException, ConstraintViolationException, AccessDeniedException, ItemExistsException, NoSuchNodeTypeException, UnsupportedRepositoryOperationException, VersionException {
+ private void execute(Operation workspaceOperation) throws RepositoryException {
log.debug("executing " + workspaceOperation.getName());
workspaceOperation.accept(this);
}
//-----------------------------------------------< OperationVisitor >---
- /**
- * @see OperationVisitor#visit(AddNode)
- */
+
+ @Override
public void visit(AddNode operation) throws RepositoryException {
NodeId parentId = operation.getParentId();
batch.addNode(parentId, operation.getNodeName(), operation.getNodeTypeName(), operation.getUuid());
}
- /**
- * @see OperationVisitor#visit(AddProperty)
- */
+ @Override
public void visit(AddProperty operation) throws RepositoryException {
NodeId parentId = operation.getParentId();
Name propertyName = operation.getPropertyName();
@@ -911,28 +891,23 @@ public class WorkspaceManager
}
}
- /**
- * @see OperationVisitor#visit(Clone)
- */
- public void visit(Clone operation) throws NoSuchWorkspaceException, LockException, ConstraintViolationException, AccessDeniedException, ItemExistsException, UnsupportedRepositoryOperationException, VersionException, RepositoryException {
+ @Override
+ public void visit(Clone operation) throws RepositoryException {
NodeId nId = operation.getNodeId();
NodeId destParentId = operation.getDestinationParentId();
- service.clone(sessionInfo, operation.getWorkspaceName(), nId, destParentId, operation.getDestinationName(), operation.isRemoveExisting());
+ service.clone(sessionInfo, operation.getWorkspaceName(), nId, destParentId, operation.getDestinationName(),
+ operation.isRemoveExisting());
}
- /**
- * @see OperationVisitor#visit(Copy)
- */
- public void visit(Copy operation) throws NoSuchWorkspaceException, LockException, ConstraintViolationException, AccessDeniedException, ItemExistsException, UnsupportedRepositoryOperationException, VersionException, RepositoryException {
+ @Override
+ public void visit(Copy operation) throws RepositoryException {
NodeId nId = operation.getNodeId();
NodeId destParentId = operation.getDestinationParentId();
service.copy(sessionInfo, operation.getWorkspaceName(), nId, destParentId, operation.getDestinationName());
}
- /**
- * @see OperationVisitor#visit(Move)
- */
- public void visit(Move operation) throws LockException, ConstraintViolationException, AccessDeniedException, ItemExistsException, UnsupportedRepositoryOperationException, VersionException, RepositoryException {
+ @Override
+ public void visit(Move operation) throws RepositoryException {
NodeId moveId = operation.getSourceId();
NodeId destParentId = operation.getDestinationParentId();
@@ -943,38 +918,28 @@ public class WorkspaceManager
}
}
- /**
- * @see OperationVisitor#visit(Update)
- */
- public void visit(Update operation) throws NoSuchWorkspaceException, AccessDeniedException, LockException, InvalidItemStateException, RepositoryException {
+ @Override
+ public void visit(Update operation) throws RepositoryException {
NodeId nId = operation.getNodeId();
service.update(sessionInfo, nId, operation.getSourceWorkspaceName());
}
- /**
- * @see OperationVisitor#visit(Remove)
- */
+ @Override
public void visit(Remove operation) throws RepositoryException {
batch.remove(operation.getRemoveId());
}
- /**
- * @see OperationVisitor#visit(SetMixin)
- */
+ @Override
public void visit(SetMixin operation) throws RepositoryException {
batch.setMixins(operation.getNodeId(), operation.getMixinNames());
}
- /**
- * @see OperationVisitor#visit(SetPrimaryType)
- */
+ @Override
public void visit(SetPrimaryType operation) throws RepositoryException {
batch.setPrimaryType(operation.getNodeId(), operation.getPrimaryTypeName());
}
- /**
- * @see OperationVisitor#visit(SetPropertyValue)
- */
+ @Override
public void visit(SetPropertyValue operation) throws RepositoryException {
PropertyId id = operation.getPropertyId();
if (operation.isMultiValued()) {
@@ -984,9 +949,7 @@ public class WorkspaceManager
}
}
- /**
- * @see OperationVisitor#visit(ReorderNodes)
- */
+ @Override
public void visit(ReorderNodes operation) throws RepositoryException {
NodeId parentId = operation.getParentId();
NodeId insertId = operation.getInsertId();
@@ -994,10 +957,8 @@ public class WorkspaceManager
batch.reorderNodes(parentId, insertId, beforeId);
}
- /**
- * @see OperationVisitor#visit(Checkout)
- */
- public void visit(Checkout operation) throws UnsupportedRepositoryOperationException, LockException, RepositoryException {
+ @Override
+ public void visit(Checkout operation) throws RepositoryException {
if (operation.supportsActivity()) {
service.checkout(sessionInfo, operation.getNodeId(), operation.getActivityId());
} else {
@@ -1005,18 +966,14 @@ public class WorkspaceManager
}
}
- /**
- * @see OperationVisitor#visit(Checkin)
- */
- public void visit(Checkin operation) throws UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException {
+ @Override
+ public void visit(Checkin operation) throws RepositoryException {
NodeId newId = service.checkin(sessionInfo, operation.getNodeId());
operation.setNewVersionId(newId);
}
- /**
- * @see OperationVisitor#visit(Checkpoint)
- */
- public void visit(Checkpoint operation) throws UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException {
+ @Override
+ public void visit(Checkpoint operation) throws RepositoryException {
NodeId newId;
if (operation.supportsActivity()) {
newId = service.checkpoint(sessionInfo, operation.getNodeId(), operation.getActivityId());
@@ -1026,10 +983,8 @@ public class WorkspaceManager
operation.setNewVersionId(newId);
}
- /**
- * @see OperationVisitor#visit(Restore)
- */
- public void visit(Restore operation) throws VersionException, PathNotFoundException, ItemExistsException, UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException {
+ @Override
+ public void visit(Restore operation) throws RepositoryException {
NodeId nId = operation.getNodeId();
if (nId == null) {
service.restore(sessionInfo, operation.getVersionIds(), operation.removeExisting());
@@ -1046,104 +1001,83 @@ public class WorkspaceManager
}
}
- /**
- * @see OperationVisitor#visit(Merge)
- */
- public void visit(Merge operation) throws NoSuchWorkspaceException, AccessDeniedException, MergeException, LockException, InvalidItemStateException, RepositoryException {
+ @Override
+ public void visit(Merge operation) throws RepositoryException {
NodeId nId = operation.getNodeId();
Iterator<NodeId> failed;
if (operation.isActivityMerge()) {
failed = service.mergeActivity(sessionInfo, nId);
} else {
- failed = service.merge(sessionInfo, nId, operation.getSourceWorkspaceName(), operation.bestEffort(), operation.isShallow());
+ failed = service.merge(sessionInfo, nId, operation.getSourceWorkspaceName(), operation.bestEffort(),
+ operation.isShallow());
}
operation.setFailedIds(failed);
}
- /**
- * @see OperationVisitor#visit(ResolveMergeConflict)
- */
- public void visit(ResolveMergeConflict operation) throws VersionException, InvalidItemStateException, UnsupportedRepositoryOperationException, RepositoryException {
+ @Override
+ public void visit(ResolveMergeConflict operation) throws RepositoryException {
NodeId nId = operation.getNodeId();
NodeId[] mergedFailedIds = operation.getMergeFailedIds();
NodeId[] predecessorIds = operation.getPredecessorIds();
service.resolveMergeConflict(sessionInfo, nId, mergedFailedIds, predecessorIds);
}
- /**
- * @see OperationVisitor#visit(LockOperation)
- */
- public void visit(LockOperation operation) throws AccessDeniedException, InvalidItemStateException, UnsupportedRepositoryOperationException, LockException, RepositoryException {
- LockInfo lInfo = service.lock(sessionInfo, operation.getNodeId(), operation.isDeep(), operation.isSessionScoped(), operation.getTimeoutHint(), operation.getOwnerHint());
+ @Override
+ public void visit(LockOperation operation) throws RepositoryException {
+ LockInfo lInfo = service.lock(sessionInfo, operation.getNodeId(), operation.isDeep(),
+ operation.isSessionScoped(), operation.getTimeoutHint(), operation.getOwnerHint());
+
operation.setLockInfo(lInfo);
}
- /**
- * @see OperationVisitor#visit(LockRefresh)
- */
- public void visit(LockRefresh operation) throws AccessDeniedException, InvalidItemStateException, UnsupportedRepositoryOperationException, LockException, RepositoryException {
+ @Override
+ public void visit(LockRefresh operation) throws RepositoryException {
service.refreshLock(sessionInfo, operation.getNodeId());
}
- /**
- * @see OperationVisitor#visit(LockRelease)
- */
- public void visit(LockRelease operation) throws AccessDeniedException, InvalidItemStateException, UnsupportedRepositoryOperationException, LockException, RepositoryException {
+ @Override
+ public void visit(LockRelease operation) throws RepositoryException {
service.unlock(sessionInfo, operation.getNodeId());
}
- /**
- * @see OperationVisitor#visit(AddLabel)
- */
- public void visit(AddLabel operation) throws VersionException, RepositoryException {
+ @Override
+ public void visit(AddLabel operation) throws RepositoryException {
NodeId vhId = operation.getVersionHistoryId();
NodeId vId = operation.getVersionId();
service.addVersionLabel(sessionInfo, vhId, vId, operation.getLabel(), operation.moveLabel());
}
- /**
- * @see OperationVisitor#visit(RemoveLabel)
- */
- public void visit(RemoveLabel operation) throws VersionException, RepositoryException {
+ @Override
+ public void visit(RemoveLabel operation) throws RepositoryException {
NodeId vhId = operation.getVersionHistoryId();
NodeId vId = operation.getVersionId();
service.removeVersionLabel(sessionInfo, vhId, vId, operation.getLabel());
}
- /**
- * @see OperationVisitor#visit(RemoveVersion)
- */
- public void visit(RemoveVersion operation) throws VersionException, AccessDeniedException, ReferentialIntegrityException, RepositoryException {
+ @Override
+ public void visit(RemoveVersion operation) throws RepositoryException {
NodeId versionId = (NodeId) operation.getRemoveId();
NodeState vhState = operation.getParentState();
service.removeVersion(sessionInfo, (NodeId) vhState.getWorkspaceId(), versionId);
}
- /**
- * @see OperationVisitor#visit(WorkspaceImport)
- */
+ @Override
public void visit(WorkspaceImport operation) throws RepositoryException {
service.importXml(sessionInfo, operation.getNodeId(), operation.getXmlStream(), operation.getUuidBehaviour());
}
- /**
- * @see OperationVisitor#visit(CreateActivity)
- */
+ @Override
public void visit(CreateActivity operation) throws RepositoryException {
NodeId activityId = service.createActivity(sessionInfo, operation.getTitle());
operation.setNewActivityId(activityId);
}
- /**
- * @see OperationVisitor#visit(RemoveActivity)
- */
+ @Override
public void visit(RemoveActivity operation) throws RepositoryException {
service.removeActivity(sessionInfo, (NodeId) operation.getRemoveId());
}
- /**
- * @see OperationVisitor#visit(CreateConfiguration)
- */
+ @Override
public void visit(CreateConfiguration operation) throws RepositoryException {
NodeId configId = service.createConfiguration(sessionInfo, operation.getNodeId());
operation.setNewConfigurationId(configId);
@@ -1151,6 +1085,7 @@ public class WorkspaceManager
}
//------------------------------------------------------< ChangePolling >---
+
/**
* Implements the polling for changes on the repository service.
*/
@@ -1170,22 +1105,23 @@ public class WorkspaceManager
this.pollTimeout = pollTimeout;
}
+ @Override
public void run() {
String wspName = sessionInfo.getWorkspaceName();
while (!Thread.interrupted() && !disposeChangeFeed) {
try {
InternalEventListener[] iel;
- Subscription subscr;
+ Subscription subscription;
synchronized (listeners) {
- while (subscription == null) {
+ while (WorkspaceManager.this.subscription == null) {
listeners.wait();
}
iel = listeners.toArray(new InternalEventListener[listeners.size()]);
- subscr = subscription;
+ subscription = WorkspaceManager.this.subscription;
}
log.debug("calling getEvents() (Workspace={})", wspName);
- EventBundle[] bundles = service.getEvents(subscr, pollTimeout);
+ EventBundle[] bundles = service.getEvents(subscription, pollTimeout);
log.debug("returned from getEvents() (Workspace={})", wspName);
// check if thread had been interrupted while
// getting events
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/XASessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/XASessionImpl.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/XASessionImpl.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/XASessionImpl.java Thu Sep 1 11:52:08 2011
@@ -42,17 +42,14 @@ public class XASessionImpl extends Sessi
* @param config the underlying repository configuration.
* @throws RepositoryException if an error occurs while creating a session.
*/
- XASessionImpl(XASessionInfo sessionInfo, Repository repository,
- RepositoryConfig config) throws RepositoryException {
+ XASessionImpl(XASessionInfo sessionInfo, Repository repository, RepositoryConfig config) throws RepositoryException {
super(sessionInfo, repository, config);
this.sessionInfo = sessionInfo;
}
//--------------------------------< XASession >-----------------------------
- /**
- * @see org.apache.jackrabbit.jcr2spi.XASession#getXAResource()
- */
+ @Override
public XAResource getXAResource() {
return sessionInfo.getXAResource();
}
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/config/RepositoryConfig.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/config/RepositoryConfig.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/config/RepositoryConfig.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/config/RepositoryConfig.java Thu Sep 1 11:52:08 2011
@@ -30,15 +30,15 @@ import org.apache.jackrabbit.spi.Reposit
*/
public interface RepositoryConfig {
- public RepositoryService getRepositoryService() throws RepositoryException;
+ RepositoryService getRepositoryService() throws RepositoryException;
- public CacheBehaviour getCacheBehaviour();
+ CacheBehaviour getCacheBehaviour();
- public int getItemCacheSize();
+ int getItemCacheSize();
/**
* Specifies an interval used for polling the {@link RepositoryService} for changes.
* @return the poll timeout in milliseconds.
*/
- public int getPollTimeout();
+ int getPollTimeout();
}
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeAttic.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeAttic.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeAttic.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeAttic.java Thu Sep 1 11:52:08 2011
@@ -16,27 +16,20 @@
*/
package org.apache.jackrabbit.jcr2spi.hierarchy;
+import org.apache.jackrabbit.spi.Name;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.apache.jackrabbit.spi.Name;
-import java.util.Iterator;
-import java.util.Set;
+import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
-import java.util.ArrayList;
+import java.util.Set;
/**
* <code>ChildNodeAttic</code>...
*/
class ChildNodeAttic {
-
- private static Logger log = LoggerFactory.getLogger(ChildNodeAttic.class);
-
- private Set<NodeEntryImpl> attic = new HashSet<NodeEntryImpl>();
-
- ChildNodeAttic() {
- }
+ private final Set<NodeEntryImpl> attic = new HashSet<NodeEntryImpl>();
boolean isEmpty() {
return attic.isEmpty();
@@ -53,9 +46,7 @@ class ChildNodeAttic {
boolean contains(Name name, int index, String uniqueId) {
for (NodeEntryImpl ne : attic) {
- if (uniqueId != null && uniqueId.equals(ne.getUniqueID())) {
- return true;
- } else if (ne.matches(name, index)) {
+ if (uniqueId != null && uniqueId.equals(ne.getUniqueID()) || ne.matches(name, index)) {
return true;
}
}
@@ -112,19 +103,7 @@ class ChildNodeAttic {
}
boolean remove(NodeEntry movedEntry) {
- if (attic.contains(movedEntry)) {
- return attic.remove(movedEntry);
- }
- return false;
+ return attic.contains(movedEntry) && attic.remove(movedEntry);
}
- Iterator<NodeEntryImpl> iterator() {
- return attic.iterator();
- }
-
- void clear() {
- if (attic != null) {
- attic.clear();
- }
- }
}
\ No newline at end of file