You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2014/12/17 09:06:56 UTC
[1/6] isis git commit: ISIS-928: ignoring utility shell script (add
to .gitignore).
Repository: isis
Updated Branches:
refs/heads/master ef797b1f0 -> d17f5a9a3
ISIS-928: ignoring utility shell script (add to .gitignore).
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/ba6d875a
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/ba6d875a
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/ba6d875a
Branch: refs/heads/master
Commit: ba6d875a7b28c1cb37e020318de14cc4909fa99d
Parents: ef797b1
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Wed Dec 17 00:31:08 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Wed Dec 17 00:31:08 2014 +0000
----------------------------------------------------------------------
.gitignore | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/ba6d875a/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index bb099fc..4e9ce67 100644
--- a/.gitignore
+++ b/.gitignore
@@ -43,3 +43,4 @@ JArchitectOut/
core/integtestsupport/fixture-data
rebel.xml
+recreate_archetypes.sh
[5/6] isis git commit: ISIS-284: enhancing ServicesInstaller so can
be used within mvn metamodel (basically: a flag to optionally ignore any
services that cannot be instantiated);
also fixes to IsisMetaModel to correctly set up the MetaModelValidator (co
Posted by da...@apache.org.
ISIS-284: enhancing ServicesInstaller so can be used within mvn metamodel (basically: a flag to optionally ignore any services that cannot be instantiated); also fixes to IsisMetaModel to correctly set up the MetaModelValidator (composite).
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/448516e4
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/448516e4
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/448516e4
Branch: refs/heads/master
Commit: 448516e485c275b897c1937cda210b627e7b5894
Parents: 2b62e17
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Wed Dec 17 00:53:23 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Wed Dec 17 00:53:23 2014 +0000
----------------------------------------------------------------------
.../isis/core/metamodel/app/IsisMetaModel.java | 20 +++++++----
.../runtime/services/ServiceInstantiator.java | 36 ++++++++++++++++++--
.../ServicesInstallerFromAnnotation.java | 2 +-
...InstallerFromConfigurationAndAnnotation.java | 4 +++
.../services/ServicesInstallerUtils.java | 17 +--------
5 files changed, 53 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/448516e4/core/metamodel/src/main/java/org/apache/isis/core/metamodel/app/IsisMetaModel.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/app/IsisMetaModel.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/app/IsisMetaModel.java
index 6809407..48b0bc8 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/app/IsisMetaModel.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/app/IsisMetaModel.java
@@ -19,7 +19,11 @@
package org.apache.isis.core.metamodel.app;
-import java.util.*;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
import com.google.common.collect.Lists;
import org.apache.isis.core.commons.components.ApplicationScopedComponent;
import org.apache.isis.core.commons.config.IsisConfiguration;
@@ -27,7 +31,6 @@ import org.apache.isis.core.commons.config.IsisConfigurationDefault;
import org.apache.isis.core.metamodel.facetdecorator.FacetDecorator;
import org.apache.isis.core.metamodel.layoutmetadata.LayoutMetadataReader;
import org.apache.isis.core.metamodel.layoutmetadata.json.LayoutMetadataReaderFromJson;
-import org.apache.isis.core.metamodel.metamodelvalidator.dflt.MetaModelValidatorDefault;
import org.apache.isis.core.metamodel.progmodel.ProgrammingModel;
import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
@@ -37,6 +40,7 @@ import org.apache.isis.core.metamodel.spec.ObjectSpecification;
import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
import org.apache.isis.core.metamodel.specloader.ObjectReflectorDefault;
import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidator;
+import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidatorComposite;
import org.apache.isis.core.metamodel.specloader.validator.ValidationFailures;
import static org.apache.isis.core.commons.ensure.Ensure.ensureThatArg;
@@ -67,7 +71,7 @@ public class IsisMetaModel implements ApplicationScopedComponent {
private IsisConfiguration configuration;
private ProgrammingModel programmingModel;
private Set<FacetDecorator> facetDecorators;
- private MetaModelValidator metaModelValidator;
+ private MetaModelValidatorComposite metaModelValidator;
private ValidationFailures validationFailures;
@@ -118,7 +122,8 @@ public class IsisMetaModel implements ApplicationScopedComponent {
this.facetDecorators = new TreeSet<>();
setProgrammingModelFacets(programmingModel);
- this.metaModelValidator = new MetaModelValidatorDefault();
+ this.metaModelValidator = new MetaModelValidatorComposite();
+ programmingModel.refineMetaModelValidator(metaModelValidator, configuration);
}
/**
@@ -259,16 +264,17 @@ public class IsisMetaModel implements ApplicationScopedComponent {
/**
* The {@link MetaModelValidator} in force, either defaulted or specified
- * {@link #setMetaModelValidator(MetaModelValidator) explicitly}.
+ * {@link #setMetaModelValidator(org.apache.isis.core.metamodel.specloader.validator.MetaModelValidatorComposite) explicitly}.
*/
- public MetaModelValidator getMetaModelValidator() {
+ public MetaModelValidatorComposite getMetaModelValidator() {
return metaModelValidator;
}
/**
* Optionally specify the {@link MetaModelValidator}.
+ * @param metaModelValidator
*/
- public void setMetaModelValidator(final MetaModelValidator metaModelValidator) {
+ public void setMetaModelValidator(final MetaModelValidatorComposite metaModelValidator) {
this.metaModelValidator = metaModelValidator;
}
http://git-wip-us.apache.org/repos/asf/isis/blob/448516e4/core/runtime/src/main/java/org/apache/isis/core/runtime/services/ServiceInstantiator.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/ServiceInstantiator.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/ServiceInstantiator.java
index 36d5145..322c2a2 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/ServiceInstantiator.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/ServiceInstantiator.java
@@ -70,12 +70,19 @@ public final class ServiceInstantiator {
private final static Logger LOG = LoggerFactory.getLogger(ServiceInstantiator.class);
-
public ServiceInstantiator() {
}
// //////////////////////////////////////
+ private boolean ignoreFailures;
+ public void setIgnoreFailures(boolean ignoreFailures) {
+ this.ignoreFailures = ignoreFailures;
+ }
+
+ // //////////////////////////////////////
+
+
/**
* initially null, but checked before first use that has been set (through {@link #setConfiguration(org.apache.isis.core.commons.config.IsisConfiguration)}).
*/
@@ -91,9 +98,33 @@ public final class ServiceInstantiator {
}
}
+ // //////////////////////////////////////
+
+ public Object createInstance(String type) {
+ final Class<?> cls = loadClass(type);
+ if(cls == null || cls.isAnonymousClass()) {
+ // eg a test class
+ return null;
+ }
+
+ return createInstance(cls);
+ }
+
+ private Class<?> loadClass(final String className) {
+ try {
+ LOG.debug("loading class for service: " + className);
+ //return Thread.currentThread().getContextClassLoader().loadClass(className);
+ return Class.forName(className);
+ } catch (final ClassNotFoundException ex) {
+ if(ignoreFailures) {
+ return null;
+ }
+ throw new InitialisationException(String.format("Cannot find class '%s' for service", className));
+ }
+ }
// //////////////////////////////////////
-
+
public <T> T createInstance(final Class<T> cls) {
ensureInitialized();
if(cls.isAnnotationPresent(RequestScoped.class)) {
@@ -333,4 +364,5 @@ public final class ServiceInstantiator {
}
}
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/448516e4/core/runtime/src/main/java/org/apache/isis/core/runtime/services/ServicesInstallerFromAnnotation.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/ServicesInstallerFromAnnotation.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/ServicesInstallerFromAnnotation.java
index 2762787..a14ed16 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/ServicesInstallerFromAnnotation.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/ServicesInstallerFromAnnotation.java
@@ -222,7 +222,7 @@ public class ServicesInstallerFromAnnotation extends InstallerAbstract implement
String order = domainServiceLayout != null ? domainServiceLayout.menuOrder(): null;
if(order == null || order.equals("" + Integer.MAX_VALUE)) {
final DomainService domainService = cls.getAnnotation(DomainService.class);
- order = domainService.menuOrder();
+ order = domainService != null ? domainService.menuOrder() : "" + Integer.MAX_VALUE;
}
return order;
}
http://git-wip-us.apache.org/repos/asf/isis/blob/448516e4/core/runtime/src/main/java/org/apache/isis/core/runtime/services/ServicesInstallerFromConfigurationAndAnnotation.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/ServicesInstallerFromConfigurationAndAnnotation.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/ServicesInstallerFromConfigurationAndAnnotation.java
index dc4d762..44dbd52 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/ServicesInstallerFromConfigurationAndAnnotation.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/ServicesInstallerFromConfigurationAndAnnotation.java
@@ -52,6 +52,10 @@ public class ServicesInstallerFromConfigurationAndAnnotation extends InstallerAb
servicesInstallerFromAnnotation = new ServicesInstallerFromAnnotation(serviceInstantiator);
}
+ public void setIgnoreFailures(boolean ignoreFailures) {
+ this.serviceInstantiator.setIgnoreFailures(ignoreFailures);
+ }
+
@Override
public void setConfigurationBuilder(IsisConfigurationBuilder isisConfigurationBuilder) {
servicesInstallerFromConfiguration.setConfigurationBuilder(isisConfigurationBuilder);
http://git-wip-us.apache.org/repos/asf/isis/blob/448516e4/core/runtime/src/main/java/org/apache/isis/core/runtime/services/ServicesInstallerUtils.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/ServicesInstallerUtils.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/ServicesInstallerUtils.java
index ba95105..2321dcc 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/ServicesInstallerUtils.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/ServicesInstallerUtils.java
@@ -78,24 +78,9 @@ final class ServicesInstallerUtils {
type = serviceName;
}
- final Class<?> cls = loadClass(type);
- if(cls.isAnonymousClass()) {
- // eg a test class
- return null;
- }
- return serviceInstantiator.createInstance(cls);
- }
-
- private static Class<?> loadClass(final String className) {
- try {
- LOG.debug("loading class for service: " + className);
- return Thread.currentThread().getContextClassLoader().loadClass(className);
- } catch (final ClassNotFoundException ex) {
- throw new InitialisationException(String.format("Cannot find class '%s' for service", className));
- }
+ return serviceInstantiator.createInstance(type);
}
-
static List<Object> instantiateServicesFrom(SortedMap<String, SortedSet<String>> positionedServices, final ServiceInstantiator serviceInstantiator) {
LinkedHashSet<String> serviceNameList = flatten(positionedServices);
[2/6] isis git commit: ISIS-928: minor updates to todoapp and
simpleapp (doc changes, tiny bug fix)
Posted by da...@apache.org.
ISIS-928: minor updates to todoapp and simpleapp (doc changes, tiny bug fix)
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/649f1680
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/649f1680
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/649f1680
Branch: refs/heads/master
Commit: 649f1680b1fe7a5157f1ce3b5a1cdba659cbfca7
Parents: ba6d875
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Wed Dec 17 00:33:10 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Wed Dec 17 00:33:10 2014 +0000
----------------------------------------------------------------------
.../simpleapp/webapp/src/main/webapp/WEB-INF/isis.properties | 8 ++------
.../todoapp/dom/src/main/java/dom/todo/ToDoItem.java | 2 +-
.../webapp/src/main/java/webapp/CustomMementoService.java | 2 +-
.../todoapp/webapp/src/main/webapp/WEB-INF/isis.properties | 8 ++------
4 files changed, 6 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/649f1680/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/isis.properties
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/isis.properties b/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/isis.properties
index b149d8f..9387f00 100644
--- a/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/isis.properties
+++ b/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/isis.properties
@@ -21,7 +21,7 @@
# specify system components.
#
# The values correspond to the named components in the installer-registry.properties file
-# in the org.apache.isis.runtimes.dflt:runtime JAR (in the org.apache.isis.runtimes.dflt.runtime package)
+# in the org.apache.isis.core:isis-core-runtime JAR (in the org.apache.isis.core.runtime package)
#
# Although all configuration could reside in isis.properties, the recommendation is
# to split out into component specific files:
@@ -32,11 +32,7 @@
# * xxx is the component type, and
# * yyy is the component name.
#
-# For example, persistor_sql.properties holds configuration information specific to the
-#
-#
-# If the components are changed, also remember to edit pom.xml (further comments can be
-# found in the persistor_xxx.properties files)
+# For example, viewer_wicket.properties holds configuration information specific to the Wicket viewer.
#
#################################################################################
http://git-wip-us.apache.org/repos/asf/isis/blob/649f1680/example/application/todoapp/dom/src/main/java/dom/todo/ToDoItem.java
----------------------------------------------------------------------
diff --git a/example/application/todoapp/dom/src/main/java/dom/todo/ToDoItem.java b/example/application/todoapp/dom/src/main/java/dom/todo/ToDoItem.java
index a4243d5..98dbe91 100644
--- a/example/application/todoapp/dom/src/main/java/dom/todo/ToDoItem.java
+++ b/example/application/todoapp/dom/src/main/java/dom/todo/ToDoItem.java
@@ -208,7 +208,7 @@ public class ToDoItem implements Categorized, Comparable<ToDoItem> {
Professional {
@Override
public List<Subcategory> subcategories() {
- return Arrays.asList(null, Subcategory.OpenSource, Subcategory.Consulting, Subcategory.Education);
+ return Arrays.asList(null, Subcategory.OpenSource, Subcategory.Consulting, Subcategory.Education, Subcategory.Marketing);
}
}, Domestic {
@Override
http://git-wip-us.apache.org/repos/asf/isis/blob/649f1680/example/application/todoapp/webapp/src/main/java/webapp/CustomMementoService.java
----------------------------------------------------------------------
diff --git a/example/application/todoapp/webapp/src/main/java/webapp/CustomMementoService.java b/example/application/todoapp/webapp/src/main/java/webapp/CustomMementoService.java
index 85f4ba3..82a8a18 100644
--- a/example/application/todoapp/webapp/src/main/java/webapp/CustomMementoService.java
+++ b/example/application/todoapp/webapp/src/main/java/webapp/CustomMementoService.java
@@ -32,7 +32,7 @@ import org.apache.isis.core.runtime.services.memento.MementoServiceDefault;
* <pre>
* isis.services = \
* ...,
- * 1:webapp.MyMementoService,
+ * 1:webapp.CustomMementoService,
* ...,
* </pre>
* <p>
http://git-wip-us.apache.org/repos/asf/isis/blob/649f1680/example/application/todoapp/webapp/src/main/webapp/WEB-INF/isis.properties
----------------------------------------------------------------------
diff --git a/example/application/todoapp/webapp/src/main/webapp/WEB-INF/isis.properties b/example/application/todoapp/webapp/src/main/webapp/WEB-INF/isis.properties
index 805a6c3..bb0d6dd 100644
--- a/example/application/todoapp/webapp/src/main/webapp/WEB-INF/isis.properties
+++ b/example/application/todoapp/webapp/src/main/webapp/WEB-INF/isis.properties
@@ -21,7 +21,7 @@
# specify system components.
#
# The values correspond to the named components in the installer-registry.properties file
-# in the org.apache.isis.runtimes.dflt:runtime JAR (in the org.apache.isis.runtimes.dflt.runtime package)
+# in the org.apache.isis.core:isis-core-runtime JAR (in the org.apache.isis.core.runtime package)
#
# Although all configuration could reside in isis.properties, the recommendation is
# to split out into component specific files:
@@ -32,11 +32,7 @@
# * xxx is the component type, and
# * yyy is the component name.
#
-# For example, persistor_sql.properties holds configuration information specific to the
-#
-#
-# If the components are changed, also remember to edit pom.xml (further comments can be
-# found in the persistor_xxx.properties files)
+# For example, viewer_wicket.properties holds configuration information specific to the Wicket viewer.
#
#################################################################################
[4/6] isis git commit: ISIS-981: reordering import statements is all.
Posted by da...@apache.org.
ISIS-981: reordering import statements is all.
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/2b62e175
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/2b62e175
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/2b62e175
Branch: refs/heads/master
Commit: 2b62e175ccaa55f8486e7a5da7914f0c1abb08b5
Parents: 0417a91
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Wed Dec 17 00:41:02 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Wed Dec 17 00:41:02 2014 +0000
----------------------------------------------------------------------
.../shiro/ShiroAuthenticatorOrAuthorizor.java | 31 +++++++++-----------
1 file changed, 14 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/2b62e175/core/security-shiro/src/main/java/org/apache/isis/security/shiro/ShiroAuthenticatorOrAuthorizor.java
----------------------------------------------------------------------
diff --git a/core/security-shiro/src/main/java/org/apache/isis/security/shiro/ShiroAuthenticatorOrAuthorizor.java b/core/security-shiro/src/main/java/org/apache/isis/security/shiro/ShiroAuthenticatorOrAuthorizor.java
index 0f27fbe..f893ed4 100644
--- a/core/security-shiro/src/main/java/org/apache/isis/security/shiro/ShiroAuthenticatorOrAuthorizor.java
+++ b/core/security-shiro/src/main/java/org/apache/isis/security/shiro/ShiroAuthenticatorOrAuthorizor.java
@@ -22,21 +22,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Set;
-
-import org.apache.isis.applib.Identifier;
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.commons.config.IsisConfiguration;
-import org.apache.isis.core.runtime.authentication.AuthenticationManagerInstaller;
-import org.apache.isis.core.runtime.authentication.AuthenticationRequest;
-import org.apache.isis.core.runtime.authentication.AuthenticationRequestPassword;
-import org.apache.isis.core.runtime.authentication.standard.Authenticator;
-import org.apache.isis.core.runtime.authentication.standard.SimpleSession;
-import org.apache.isis.core.runtime.authorization.AuthorizationManagerInstaller;
-import org.apache.isis.core.runtime.authorization.standard.Authorizor;
-import org.apache.isis.security.shiro.authorization.IsisPermission;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import com.google.common.collect.Lists;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.UnavailableSecurityManagerException;
import org.apache.shiro.authc.AuthenticationException;
@@ -53,8 +39,19 @@ import org.apache.shiro.mgt.SecurityManager;
import org.apache.shiro.realm.Realm;
import org.apache.shiro.subject.PrincipalCollection;
import org.apache.shiro.subject.Subject;
-
-import com.google.common.collect.Lists;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.isis.applib.Identifier;
+import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.runtime.authentication.AuthenticationManagerInstaller;
+import org.apache.isis.core.runtime.authentication.AuthenticationRequest;
+import org.apache.isis.core.runtime.authentication.AuthenticationRequestPassword;
+import org.apache.isis.core.runtime.authentication.standard.Authenticator;
+import org.apache.isis.core.runtime.authentication.standard.SimpleSession;
+import org.apache.isis.core.runtime.authorization.AuthorizationManagerInstaller;
+import org.apache.isis.core.runtime.authorization.standard.Authorizor;
+import org.apache.isis.security.shiro.authorization.IsisPermission;
/**
* If Shiro is configured for both {@link AuthenticationManagerInstaller authentication} and
[3/6] isis git commit: ISIS-981: if no security manager is configured
(specifically this means,
if running in the fixtures during bootstrapping) then ALLOW the interaction,
rather than VETO it as previously.
Posted by da...@apache.org.
ISIS-981: if no security manager is configured (specifically this means, if running in the fixtures during bootstrapping) then ALLOW the interaction, rather than VETO it as previously.
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/0417a915
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/0417a915
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/0417a915
Branch: refs/heads/master
Commit: 0417a9155516fe3852e5c41634ed3150c25c4d38
Parents: 649f168
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Wed Dec 17 00:40:35 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Wed Dec 17 00:40:35 2014 +0000
----------------------------------------------------------------------
.../isis/security/shiro/ShiroAuthenticatorOrAuthorizor.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/0417a915/core/security-shiro/src/main/java/org/apache/isis/security/shiro/ShiroAuthenticatorOrAuthorizor.java
----------------------------------------------------------------------
diff --git a/core/security-shiro/src/main/java/org/apache/isis/security/shiro/ShiroAuthenticatorOrAuthorizor.java b/core/security-shiro/src/main/java/org/apache/isis/security/shiro/ShiroAuthenticatorOrAuthorizor.java
index 5241d18..0f27fbe 100644
--- a/core/security-shiro/src/main/java/org/apache/isis/security/shiro/ShiroAuthenticatorOrAuthorizor.java
+++ b/core/security-shiro/src/main/java/org/apache/isis/security/shiro/ShiroAuthenticatorOrAuthorizor.java
@@ -238,8 +238,9 @@ public class ShiroAuthenticatorOrAuthorizor implements Authenticator, Authorizor
private boolean isPermitted(Identifier identifier, String qualifier) {
RealmSecurityManager securityManager = getSecurityManager();
if(securityManager == null) {
- // cannot do permission checking if no security manager
- return false;
+ // since a security manager will always be present for regular web requests, presumably the user
+ // is running in fixtures during bootstrapping. We therefore permit the interaction.
+ return true;
}
String permission = asPermissionsString(identifier) + ":" + qualifier;
[6/6] isis git commit: ISIS-284: various fixes and enhancements to
ValidateMojo; removing builder for IsisMetaModel;
also attempt to exclude dependency on old google-collections.
Posted by da...@apache.org.
ISIS-284: various fixes and enhancements to ValidateMojo; removing builder for IsisMetaModel; also attempt to exclude dependency on old google-collections.
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/d17f5a9a
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/d17f5a9a
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/d17f5a9a
Branch: refs/heads/master
Commit: d17f5a9a33af6a983c2d782b04dbb000d5a67dde
Parents: 448516e
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Wed Dec 17 07:57:14 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Wed Dec 17 07:57:14 2014 +0000
----------------------------------------------------------------------
.../isis/core/metamodel/app/IsisMetaModel.java | 29 ----
...AdapterManagerDefault_aggregateAdapters.java | 17 +-
tool/maven-plugin/pom.xml | 5 +
.../isis/tool/mavenplugin/ValidateMojo.java | 166 +++++++------------
4 files changed, 73 insertions(+), 144 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/d17f5a9a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/app/IsisMetaModel.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/app/IsisMetaModel.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/app/IsisMetaModel.java
index 48b0bc8..6c881e8 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/app/IsisMetaModel.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/app/IsisMetaModel.java
@@ -75,35 +75,6 @@ public class IsisMetaModel implements ApplicationScopedComponent {
private ValidationFailures validationFailures;
-
- public static class Builder {
- private final RuntimeContext runtimeContext;
- private final ProgrammingModel programmingModel;
- private List<Object> services = Lists.newArrayList();
-
- private Builder(RuntimeContext embeddedContext, ProgrammingModel programmingModel) {
- this.runtimeContext = embeddedContext;
- this.programmingModel = programmingModel;
- }
-
- public Builder withServices(Object... services) {
- return withServices(Arrays.asList(services));
- }
-
- public Builder withServices(List<Object> services) {
- this.services = services;
- return this;
- }
-
- public IsisMetaModel build() {
- return new IsisMetaModel(runtimeContext, programmingModel, services);
- }
- }
-
- public static Builder builder(RuntimeContext runtimeContext, ProgrammingModel programmingModel) {
- return new Builder(runtimeContext, programmingModel);
- }
-
public IsisMetaModel(final RuntimeContext runtimeContext, ProgrammingModel programmingModel, final List<Object> services) {
this(runtimeContext, programmingModel, services.toArray());
}
http://git-wip-us.apache.org/repos/asf/isis/blob/d17f5a9a/core/runtime/src/test/java/org/apache/isis/core/runtime/persistence/adaptermanager/AdapterManagerDefault_aggregateAdapters.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/isis/core/runtime/persistence/adaptermanager/AdapterManagerDefault_aggregateAdapters.java b/core/runtime/src/test/java/org/apache/isis/core/runtime/persistence/adaptermanager/AdapterManagerDefault_aggregateAdapters.java
index 4b84123..500c3f9 100644
--- a/core/runtime/src/test/java/org/apache/isis/core/runtime/persistence/adaptermanager/AdapterManagerDefault_aggregateAdapters.java
+++ b/core/runtime/src/test/java/org/apache/isis/core/runtime/persistence/adaptermanager/AdapterManagerDefault_aggregateAdapters.java
@@ -19,16 +19,12 @@
package org.apache.isis.core.runtime.persistence.adaptermanager;
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertSame;
-
+import com.google.common.collect.Lists;
import org.jmock.Expectations;
import org.jmock.auto.Mock;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
-
import org.apache.isis.applib.annotation.Aggregated;
import org.apache.isis.applib.annotation.MemberOrder;
import org.apache.isis.applib.profiles.Localization;
@@ -40,18 +36,22 @@ import org.apache.isis.core.metamodel.adapter.ResolveState;
import org.apache.isis.core.metamodel.adapter.oid.AggregatedOid;
import org.apache.isis.core.metamodel.adapter.oid.RootOidDefault;
import org.apache.isis.core.metamodel.adapter.oid.TypedOid;
+import org.apache.isis.core.metamodel.app.IsisMetaModel;
import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
import org.apache.isis.core.metamodel.spec.ObjectSpecId;
import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
-import org.apache.isis.core.metamodel.app.IsisMetaModel;
import org.apache.isis.core.runtime.persistence.adapter.PojoAdapterFactory;
import org.apache.isis.core.runtime.system.persistence.OidGenerator;
import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
import org.apache.isis.progmodels.dflt.ProgrammingModelFacetsJava5;
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertSame;
+
public class AdapterManagerDefault_aggregateAdapters {
public static class Customer {
@@ -121,7 +121,10 @@ public class AdapterManagerDefault_aggregateAdapters {
context.ignoring(mockAuthenticationSession);
context.ignoring(mockConfiguration);
- isisMetaModel = IsisMetaModel.builder(mockRuntimeContext, new ProgrammingModelFacetsJava5()).withServices(new CustomerRepository()).build();
+ isisMetaModel = new IsisMetaModel(
+ mockRuntimeContext,
+ new ProgrammingModelFacetsJava5(),
+ Lists.newArrayList(new CustomerRepository()));
isisMetaModel.init();
adapterFactory = new PojoAdapterFactory() {
http://git-wip-us.apache.org/repos/asf/isis/blob/d17f5a9a/tool/maven-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/tool/maven-plugin/pom.xml b/tool/maven-plugin/pom.xml
index 87549f3..2e2e789 100644
--- a/tool/maven-plugin/pom.xml
+++ b/tool/maven-plugin/pom.xml
@@ -23,6 +23,7 @@
</prerequisites>
<build>
+
<pluginManagement>
<plugins>
<!-- Apache Release Audit Tool -->
@@ -256,6 +257,10 @@
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>com.google.collections</groupId>
+ <artifactId>google-collections</artifactId>
+ </exclusion>
</exclusions>
</dependency>
http://git-wip-us.apache.org/repos/asf/isis/blob/d17f5a9a/tool/maven-plugin/src/main/java/org/apache/isis/tool/mavenplugin/ValidateMojo.java
----------------------------------------------------------------------
diff --git a/tool/maven-plugin/src/main/java/org/apache/isis/tool/mavenplugin/ValidateMojo.java b/tool/maven-plugin/src/main/java/org/apache/isis/tool/mavenplugin/ValidateMojo.java
index 6d9cf54..47b4bea 100644
--- a/tool/maven-plugin/src/main/java/org/apache/isis/tool/mavenplugin/ValidateMojo.java
+++ b/tool/maven-plugin/src/main/java/org/apache/isis/tool/mavenplugin/ValidateMojo.java
@@ -20,17 +20,11 @@ package org.apache.isis.tool.mavenplugin;
*/
import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
import java.util.List;
import java.util.Set;
-
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.DependencyResolutionRequiredException;
+import org.apache.maven.model.Plugin;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
@@ -39,19 +33,17 @@ import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.ResolutionScope;
import org.apache.maven.project.MavenProject;
-import org.codehaus.classworlds.ClassRealm;
-import org.codehaus.classworlds.ClassWorld;
-import org.codehaus.classworlds.DuplicateRealmException;
import org.codehaus.plexus.util.xml.Xpp3Dom;
-
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.commons.config.IsisConfigurationBuilderDefault;
+import org.apache.isis.core.metamodel.app.IsisMetaModel;
import org.apache.isis.core.metamodel.runtimecontext.noruntime.RuntimeContextNoRuntime;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
import org.apache.isis.core.metamodel.specloader.validator.ValidationFailures;
-import org.apache.isis.core.metamodel.app.IsisMetaModel;
+import org.apache.isis.core.runtime.services.ServicesInstallerFromConfigurationAndAnnotation;
+import org.apache.isis.core.runtime.system.DeploymentType;
import org.apache.isis.progmodels.dflt.ProgrammingModelFacetsJava5;
-import org.apache.isis.tool.mavenplugin.util.ClassRealms;
-import org.apache.isis.tool.mavenplugin.util.ClassWorlds;
import org.apache.isis.tool.mavenplugin.util.IsisMetaModels;
-import org.apache.isis.tool.mavenplugin.util.Log4j;
import org.apache.isis.tool.mavenplugin.util.MavenProjects;
import org.apache.isis.tool.mavenplugin.util.Xpp3Doms;
@@ -60,135 +52,93 @@ import org.apache.isis.tool.mavenplugin.util.Xpp3Doms;
*
*
*/
-@Mojo(name = "validate", defaultPhase = LifecyclePhase.TEST, requiresProject = true, requiresDependencyResolution = ResolutionScope.COMPILE, requiresDependencyCollection = ResolutionScope.COMPILE)
+@Mojo(
+ name = "validate",
+ defaultPhase = LifecyclePhase.TEST,
+ requiresProject = true,
+ requiresDependencyResolution = ResolutionScope.COMPILE,
+ requiresDependencyCollection = ResolutionScope.COMPILE
+)
public class ValidateMojo extends AbstractMojo {
- private static final String CURRENT_PLUGIN_KEY = "org.apache.isis.tools:isis-maven-plugin";
- private static final String ISIS_REALM = "isis";
+ private static final String CURRENT_PLUGIN_KEY = "org.apache.isis.tool:isis-maven-plugin";
@Component
protected MavenProject mavenProject;
public void execute() throws MojoExecutionException, MojoFailureException {
- Log4j.configureIfRequired();
-
- ValidationFailures validationFailures = bootIsisThenShutdown();
+ final List<Object> serviceList = getServiceList();
+ if(serviceList.size() == 0) {
+ return;
+ }
+ getLog().info("Found " + serviceList.size() + " services");
+ final ValidationFailures validationFailures = bootIsisThenShutdown(serviceList);
if (validationFailures.occurred()) {
throwFailureException(validationFailures.getNumberOfMessages() + " problems found.", validationFailures.getMessages());
}
}
- private ValidationFailures bootIsisThenShutdown() throws MojoExecutionException, MojoFailureException {
- ClassWorld classWorld = null;
+ private ValidationFailures bootIsisThenShutdown(List<Object> serviceList) throws MojoExecutionException, MojoFailureException {
IsisMetaModel isisMetaModel = null;
try {
- classWorld = new ClassWorld();
- final ClassRealm isisRealm = classWorld.newRealm(ISIS_REALM);
-
- addClassesToRealm(isisRealm);
-
- List<Object> serviceList = createServicesFromConfiguration(isisRealm);
-
- isisMetaModel = bootstrapIsis(isisRealm, serviceList);
+ isisMetaModel = bootstrapIsis(serviceList);
+ final Collection<ObjectSpecification> objectSpecifications = isisMetaModel.getSpecificationLoader().allSpecifications();
+ for (ObjectSpecification objectSpecification : objectSpecifications) {
+ getLog().debug("loaded: " + objectSpecification.getFullIdentifier());
+ }
return isisMetaModel.getValidationFailures();
- } catch (DuplicateRealmException e) {
- throwExecutionException("Error building classworld", e);
- return null; // never reached, since exception thrown above
} finally {
- ClassWorlds.disposeSafely(classWorld, ISIS_REALM);
IsisMetaModels.disposeSafely(isisMetaModel);
}
}
- @SuppressWarnings("unchecked")
- private void addClassesToRealm(final ClassRealm isisRealm) throws MojoExecutionException {
-
- // first add all dependencies (including transitive)...
- Set<Artifact> artifacts = mavenProject.getArtifacts();
- for (Artifact artifact : artifacts) {
- File file = artifact.getFile();
- try {
- ClassRealms.addFileToRealm(isisRealm, file, getLog());
- } catch (MalformedURLException e) {
- throwExecutionException("Error adding classes for artifact '" + artifact + "' to class realm", e);
- } catch (IOException e) {
- throwExecutionException("Error adding classes for artifact '" + artifact + "' to class realm", e);
- }
- }
- // ... then all classpath elements
- // (there is substantial overlap with getArtifacts() here, but neither
- // appears to
- // provide the comprehensive set of class path elements).
- List<String> classpathElements;
- try {
- classpathElements = mavenProject.getRuntimeClasspathElements();
- } catch (DependencyResolutionRequiredException e) {
- throwExecutionException("Error obtaining runtime classpath", e);
- return;
- }
- for (String classpathElement : classpathElements) {
- final File file = new File(classpathElement);
- try {
- ClassRealms.addFileToRealm(isisRealm, file, getLog());
- } catch (MalformedURLException e) {
- throwExecutionException("Error adding classes for classpath element '" + classpathElement + "' to class realm", e);
- } catch (IOException e) {
- throwExecutionException("Error adding classes for classpath element '" + classpathElement + "' to class realm", e);
- }
+ private List<Object> getServiceList() throws MojoFailureException {
+ IsisConfiguration isisConfiguration = getIsisConfiguration();
+ if(isisConfiguration == null) {
+ return Collections.emptyList();
}
- }
- private List<Object> createServicesFromConfiguration(final ClassRealm isisRealm) throws MojoFailureException {
- final List<String> serviceEls = getServiceClassNamesFromConfiguration();
- return createServiceInstances(isisRealm, serviceEls);
+ final ServicesInstallerFromConfigurationAndAnnotation servicesInstaller = new ServicesInstallerFromConfigurationAndAnnotation();
+ servicesInstaller.setIgnoreFailures(true);
+ servicesInstaller.setConfiguration(isisConfiguration);
+ servicesInstaller.init();
+ return servicesInstaller.getServices(DeploymentType.SERVER_PROTOTYPE);
}
- private List<String> getServiceClassNamesFromConfiguration() throws MojoFailureException {
- final Xpp3Dom configuration = (Xpp3Dom) MavenProjects.lookupPlugin(mavenProject, CURRENT_PLUGIN_KEY).getConfiguration();
+ private IsisConfiguration getIsisConfiguration() throws MojoFailureException {
+ final Plugin plugin = MavenProjects.lookupPlugin(mavenProject, CURRENT_PLUGIN_KEY);
+ if(plugin == null) {
+ return null;
+ }
+ final Xpp3Dom configuration = (Xpp3Dom) plugin.getConfiguration();
if (configuration == null) {
throwFailureException("Configuration error", "No <configuration> element found");
}
- final Xpp3Dom servicesEl = configuration.getChild("services");
+ final Xpp3Dom servicesEl = configuration.getChild("isisConfigDir");
if (servicesEl == null) {
- throwFailureException("Configuration error", "No <configuration>/<services> element found");
- }
- final Xpp3Dom[] serviceEls = servicesEl.getChildren("service");
- if (serviceEls == null || serviceEls.length == 0) {
- throwFailureException("Configuration error", "No <configuration>/<services>/<service> elements found");
+ throwFailureException("Configuration error", "No <configuration>/<isisConfigDir> element found");
}
- return Lists.transform(Arrays.asList(serviceEls), Xpp3Doms.GET_VALUE);
- }
+ final String isisConfigDir = Xpp3Doms.GET_VALUE.apply(servicesEl);
- private List<Object> createServiceInstances(final ClassRealm isisRealm, final List<String> serviceClassNames) throws MojoFailureException {
- final List<Object> serviceList = Lists.newArrayList();
- final Set<String> logMessages = Sets.newLinkedHashSet();
- for (String serviceClassName : serviceClassNames) {
- try {
- serviceList.add(isisRealm.loadClass(serviceClassName).newInstance());
- } catch (ClassNotFoundException e) {
- logMessages.add("Error loading class '" + serviceClassName + "' from classrealm");
- } catch (InstantiationException e) {
- logMessages.add("Error instantiating loaded class '" + serviceClassName + "'");
- } catch (IllegalAccessException e) {
- logMessages.add("Error instantiating loaded class '" + serviceClassName + "'");
- }
- }
- if (!logMessages.isEmpty()) {
- throwFailureException("Unable to load configured services", logMessages);
- }
- return serviceList;
+ final File basedir = mavenProject.getBasedir();
+ final String absoluteConfigDir = new File(basedir, isisConfigDir).getAbsolutePath();
+ final IsisConfigurationBuilderDefault configBuilder = new IsisConfigurationBuilderDefault(absoluteConfigDir);
+
+ configBuilder.addDefaultConfigurationResources();
+ return configBuilder.getConfiguration();
}
- private static IsisMetaModel bootstrapIsis(final ClassRealm isisRealm, List<Object> serviceList) {
- Thread.currentThread().setContextClassLoader(isisRealm.getClassLoader());
+ private static IsisMetaModel bootstrapIsis(List<Object> serviceList) {
- IsisMetaModel isisMetaModel = IsisMetaModel.builder(new RuntimeContextNoRuntime(), new ProgrammingModelFacetsJava5()).withServices(serviceList).build();
+ IsisMetaModel isisMetaModel = new IsisMetaModel(
+ new RuntimeContextNoRuntime(),
+ new ProgrammingModelFacetsJava5(),
+ serviceList);
isisMetaModel.init();
-
return isisMetaModel;
}