org.argeo.jackrabbit,
org.argeo.jcr,
org.argeo.security,
org.argeo.jackrabbit,
org.argeo.jcr,
org.argeo.security,
+ org.argeo.security.core,
org.h2;version="[1.0.0,2.0.0)";resolution:=optional,
org.postgresql;version="[8.0.0,9.0.0)";resolution:=optional,
org.h2;version="[1.0.0,2.0.0)";resolution:=optional,
org.postgresql;version="[8.0.0,9.0.0)";resolution:=optional,
- org.springframework.beans.factory.config
+ org.springframework.beans.factory.config,
+ org.springframework.security;version="2.0.6.RELEASE"
http://www.springframework.org/schema/util/spring-util-2.5.xsd">\r
\r
<!-- REFERENCES -->\r
http://www.springframework.org/schema/util/spring-util-2.5.xsd">\r
\r
<!-- REFERENCES -->\r
- <reference id="systemExecutionService" interface="org.argeo.security.SystemExecutionService" />\r
+ <reference id="authenticationManager"\r
+ interface="org.springframework.security.AuthenticationManager" />\r
\r
<!-- SERVICES -->\r
<service ref="nodeJcrRepository" interface="javax.jcr.Repository">\r
\r
<!-- SERVICES -->\r
<service ref="nodeJcrRepository" interface="javax.jcr.Repository">\r
- <bean id="nodeJcrRepository" class="org.argeo.jackrabbit.JackrabbitContainer">
+ <bean id="nodeJcrRepository" class="org.argeo.jackrabbit.JackrabbitContainer"
+ init-method="init" destroy-method="dispose">
<property name="uri" value="${argeo.node.repo.uri}" />
<property name="homeDirectory" value="${argeo.node.repo.home}" />
<property name="configuration" value="${argeo.node.repo.configuration}" />
<property name="uri" value="${argeo.node.repo.uri}" />
<property name="homeDirectory" value="${argeo.node.repo.home}" />
<property name="configuration" value="${argeo.node.repo.configuration}" />
<value>classpath:/org/argeo/jcr/argeo.cnd</value>
</list>
</property>
<value>classpath:/org/argeo/jcr/argeo.cnd</value>
</list>
</property>
- <property name="systemExecutor" ref="systemExecutionService" />
+
+ <!-- Execute initialization with a system authentication -->
+ <bean
+ class="org.argeo.security.core.AuthenticatedApplicationContextInitialization">
+ <property name="authenticationManager" ref="authenticationManager" />
+ </bean>
+
</beans>
\ No newline at end of file
</beans>
\ No newline at end of file
/** Executes migrations, if needed. */
protected void migrate() {
/** Executes migrations, if needed. */
protected void migrate() {
+ // No migration to perform
+ if (dataModelMigrations.size() == 0)
+ return;
+
Boolean restartAndClearCaches = false;
// migrate data
Boolean restartAndClearCaches = false;
// migrate data
// JCR REPOSITORY (delegated)
public String getDescriptor(String key) {
// JCR REPOSITORY (delegated)
public String getDescriptor(String key) {
- return repository.getDescriptor(key);
+ return getRepository().getDescriptor(key);
}
public String[] getDescriptorKeys() {
}
public String[] getDescriptorKeys() {
- return repository.getDescriptorKeys();
+ return getRepository().getDescriptorKeys();
}
public Session login() throws LoginException, RepositoryException {
}
public Session login() throws LoginException, RepositoryException {
- Session session = repository.login();
+ Session session = getRepository().login();
processNewSession(session);
return session;
}
processNewSession(session);
return session;
}
RepositoryException {
Session session;
try {
RepositoryException {
Session session;
try {
- session = repository.login(credentials, workspaceName);
+ session = getRepository().login(credentials, workspaceName);
} catch (NoSuchWorkspaceException e) {
if (autocreateWorkspaces)
session = createWorkspaceAndLogsIn(credentials, workspaceName);
} catch (NoSuchWorkspaceException e) {
if (autocreateWorkspaces)
session = createWorkspaceAndLogsIn(credentials, workspaceName);
public Session login(Credentials credentials) throws LoginException,
RepositoryException {
public Session login(Credentials credentials) throws LoginException,
RepositoryException {
- Session session = repository.login(credentials);
+ Session session = getRepository().login(credentials);
processNewSession(session);
return session;
}
processNewSession(session);
return session;
}
NoSuchWorkspaceException, RepositoryException {
Session session;
try {
NoSuchWorkspaceException, RepositoryException {
Session session;
try {
- session = repository.login(workspaceName);
+ session = getRepository().login(workspaceName);
} catch (NoSuchWorkspaceException e) {
if (autocreateWorkspaces)
session = createWorkspaceAndLogsIn(null, workspaceName);
} catch (NoSuchWorkspaceException e) {
if (autocreateWorkspaces)
session = createWorkspaceAndLogsIn(null, workspaceName);
+ /** Wraps access to the repository, making sure it is available. */
+ protected Repository getRepository() {
+ if (repository == null) {
+ throw new ArgeoException(
+ "No repository initialized."
+ + " Was the init() method called?"
+ + " The dispose() method should also be called on shutdown.");
+ }
+ return repository;
+ }
+
protected synchronized void processNewSession(Session session) {
try {
NamespaceHelper namespaceHelper = new NamespaceHelper(session);
protected synchronized void processNewSession(Session session) {
try {
NamespaceHelper namespaceHelper = new NamespaceHelper(session);
String workspaceName) throws RepositoryException {
if (workspaceName == null)
throw new ArgeoException("No workspace specified.");
String workspaceName) throws RepositoryException {
if (workspaceName == null)
throw new ArgeoException("No workspace specified.");
- Session session = repository.login(credentials);
+ Session session = getRepository().login(credentials);
session.getWorkspace().createWorkspace(workspaceName);
session.logout();
session.getWorkspace().createWorkspace(workspaceName);
session.logout();
- return repository.login(credentials, workspaceName);
+ return getRepository().login(credentials, workspaceName);
}
public void setResourceLoader(ResourceLoader resourceLoader) {
}
public void setResourceLoader(ResourceLoader resourceLoader) {
}
public boolean isStandardDescriptor(String key) {
}
public boolean isStandardDescriptor(String key) {
- return repository.isStandardDescriptor(key);
+ return getRepository().isStandardDescriptor(key);
}
public boolean isSingleValueDescriptor(String key) {
}
public boolean isSingleValueDescriptor(String key) {
- return repository.isSingleValueDescriptor(key);
+ return getRepository().isSingleValueDescriptor(key);
}
public Value getDescriptorValue(String key) {
}
public Value getDescriptorValue(String key) {
- return repository.getDescriptorValue(key);
+ return getRepository().getDescriptorValue(key);
}
public Value[] getDescriptorValues(String key) {
}
public Value[] getDescriptorValues(String key) {
- return repository.getDescriptorValues(key);
+ return getRepository().getDescriptorValues(key);