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 2012/12/05 00:41:11 UTC
[36/52] [partial] ISIS-188: consolidating isis-core
http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/webapp/content/ResourceServlet.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/webapp/content/ResourceServlet.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/webapp/content/ResourceServlet.java
new file mode 100644
index 0000000..2f7b5f4
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/webapp/content/ResourceServlet.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.webapp.content;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+
+import org.apache.isis.core.commons.lang.IoUtils;
+import org.apache.isis.core.commons.lang.Resources;
+import org.apache.isis.core.commons.lang.StringUtils;
+
+public class ResourceServlet extends HttpServlet {
+
+ private static final Logger LOG = Logger.getLogger(ResourceServlet.class);
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected void doPost(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException {
+ processRequest(request, response);
+ }
+
+ @Override
+ protected void doGet(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException {
+ processRequest(request, response);
+ }
+
+ private void processRequest(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException {
+ final String servletPath = StringUtils.stripLeadingSlash(request.getServletPath());
+ if (LOG.isInfoEnabled()) {
+ LOG.info("request: " + servletPath);
+ }
+
+ // try to load from filesystem
+ final InputStream is2 = getRealPath(request);
+ if (is2 != null) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("request: " + servletPath + " loaded from filesystem");
+ }
+ IoUtils.copy(is2, response.getOutputStream());
+ is2.close();
+ return;
+ }
+
+ // otherwise, try to load from classpath
+ final InputStream is = Resources.getResourceAsStream(servletPath);
+ if (is != null) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("request: " + servletPath + " loaded from classpath");
+ }
+ IoUtils.copy(is, response.getOutputStream());
+ is.close();
+ return;
+ }
+
+ LOG.warn("failed to load resource from classpath or file system: " + servletPath);
+ }
+
+ private FileInputStream getRealPath(final HttpServletRequest request) {
+ final String realPath = request.getSession().getServletContext().getRealPath(request.getServletPath());
+ if (realPath == null) {
+ return null;
+ }
+ try {
+ return new FileInputStream(realPath);
+ } catch (final FileNotFoundException e) {
+ return null;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/webapp/routing/ForwardingServlet.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/webapp/routing/ForwardingServlet.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/webapp/routing/ForwardingServlet.java
new file mode 100644
index 0000000..f6177c3
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/webapp/routing/ForwardingServlet.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.webapp.routing;
+
+import java.io.IOException;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+public class ForwardingServlet extends HttpServlet {
+
+ private static final long serialVersionUID = 1L;
+ private String forwardTo;
+
+ @Override
+ public void init(final ServletConfig config) throws ServletException {
+ forwardTo = enslash(config.getInitParameter("forwardTo"));
+ }
+
+ private static String enslash(final String str) {
+ return str.startsWith("/") ? str : "/" + str;
+ }
+
+ @Override
+ protected void doGet(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException {
+ final RequestDispatcher requestDispatcher = request.getRequestDispatcher(forwardTo);
+ requestDispatcher.forward(request, response);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/webapp/routing/RedirectFilter.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/webapp/routing/RedirectFilter.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/webapp/routing/RedirectFilter.java
new file mode 100644
index 0000000..588d5d0
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/webapp/routing/RedirectFilter.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.webapp.routing;
+
+import java.io.IOException;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.isis.core.commons.lang.PathUtils;
+
+public class RedirectFilter implements Filter {
+
+ private String redirectTo;
+
+ protected void doGet(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException {
+
+ }
+
+ @Override
+ public void init(final FilterConfig filterConfig) throws ServletException {
+ redirectTo = filterConfig.getInitParameter("redirectTo");
+ }
+
+ @Override
+ public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain) throws IOException, ServletException {
+ final HttpServletRequest httpServletRequest = (HttpServletRequest) request;
+ final HttpServletResponse httpServletResponse = (HttpServletResponse) response;
+
+ httpServletResponse.sendRedirect(PathUtils.combine(httpServletRequest.getContextPath(), redirectTo));
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/webapp/routing/RedirectServlet.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/webapp/routing/RedirectServlet.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/webapp/routing/RedirectServlet.java
new file mode 100644
index 0000000..c3032a5
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/webapp/routing/RedirectServlet.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.webapp.routing;
+
+import java.io.IOException;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.isis.core.commons.lang.PathUtils;
+
+public class RedirectServlet extends HttpServlet {
+
+ private static final long serialVersionUID = 1L;
+ private String redirectTo;
+
+ @Override
+ public void init(final ServletConfig config) throws ServletException {
+ redirectTo = config.getInitParameter("redirectTo");
+ }
+
+ @Override
+ protected void doGet(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException {
+
+ response.sendRedirect(PathUtils.combine(request.getContextPath(), redirectTo));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/webapp/routing/RedirectToDocsFilter.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/webapp/routing/RedirectToDocsFilter.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/webapp/routing/RedirectToDocsFilter.java
new file mode 100644
index 0000000..79ee85b
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/webapp/routing/RedirectToDocsFilter.java
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.core.webapp.routing;
+
+import java.io.IOException;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+
+/**
+ * This filter attempts to ensure that would-be users of the framework are
+ * directed to the bundled documentation, rather than just hitting the REST API
+ * (ie the json viewer).
+ *
+ * <p>
+ * Specifically, if the request is to "/" but the Accept header is anything
+ * other than "application/json" (eg is set to "text/html" and suggesting that
+ * the user is using a browser to access the webapp) then the filter redirects
+ * to /index.html (the documentation pages).
+ *
+ * <p>
+ * Only if the Accept header is set to application/json is the request allowed
+ * to continue through.
+ */
+public class RedirectToDocsFilter implements Filter {
+
+ private static final Logger LOG = Logger.getLogger(RedirectToDocsFilter.class);
+
+ private static final String REDIRECT_TO_KEY = "redirectTo";
+ private static final String REDIRECT_TO_DEFAULT = "/index.html";
+
+ private static final String ACCEPT_HEADER = "Accept";
+ private static final String APPLICATION_JSON_MIME_TYPE = "application/json";
+
+ private String redirectTo;
+
+ @Override
+ public void init(final FilterConfig cfg) throws ServletException {
+ redirectTo = cfg.getInitParameter(REDIRECT_TO_KEY);
+ if (redirectTo == null) {
+ redirectTo = REDIRECT_TO_DEFAULT;
+ }
+ System.out.println("redirectToDocsFilter: redirectTo=" + redirectTo);
+ LOG.info("redirectToDocsFilter: redirectTo=" + redirectTo);
+ }
+
+ @Override
+ public void destroy() {
+ }
+
+ @Override
+ public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain) throws IOException, ServletException {
+ final HttpServletRequest httpServletRequest = (HttpServletRequest) request;
+ final HttpServletResponse httpServletResponse = (HttpServletResponse) response;
+
+ // do nothing if not requesting "/"
+ final String servletPath = httpServletRequest.getServletPath();
+ System.out.println("redirectToDocsFilter: servletPath: " + servletPath);
+ LOG.info("redirectToDocsFilter: servletPath: " + servletPath);
+
+ if (!"/".equals(servletPath)) {
+ chain.doFilter(request, response);
+ return;
+ }
+
+ final String acceptHeader = httpServletRequest.getHeader(ACCEPT_HEADER);
+ if (acceptHeader != null && acceptHeader.startsWith(APPLICATION_JSON_MIME_TYPE)) {
+ // let request through
+ chain.doFilter(request, response);
+ return;
+ }
+
+ // otherwise redirect
+ final String redirect = combine(httpServletRequest.getContextPath(), redirectTo);
+ System.out.println("redirectToDocsFilter: redirecting to: " + redirect);
+ LOG.info("redirectToDocsFilter: redirecting to: " + redirect);
+
+ httpServletResponse.sendRedirect(redirect);
+ }
+
+ private static String combine(final String str1, final String str2) {
+ final StringBuilder buf = new StringBuilder(str1);
+ if (!str2.startsWith("/")) {
+ buf.append("/");
+ }
+ buf.append(str2);
+ return buf.toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/JavaReflectorHelper.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/JavaReflectorHelper.java b/framework/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/JavaReflectorHelper.java
new file mode 100644
index 0000000..fdd0f11
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/JavaReflectorHelper.java
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.progmodels.dflt;
+
+import java.util.Collection;
+import java.util.Set;
+
+import org.apache.log4j.Logger;
+
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.metamodel.facetapi.ClassSubstitutorFactory;
+import org.apache.isis.core.metamodel.facetapi.MetaModelRefiner;
+import org.apache.isis.core.metamodel.facetdecorator.FacetDecorator;
+import org.apache.isis.core.metamodel.layout.MemberLayoutArranger;
+import org.apache.isis.core.metamodel.progmodel.ProgrammingModel;
+import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
+import org.apache.isis.core.metamodel.specloader.ObjectReflectorDefault;
+import org.apache.isis.core.metamodel.specloader.classsubstitutor.ClassSubstitutor;
+import org.apache.isis.core.metamodel.specloader.collectiontyperegistry.CollectionTypeRegistry;
+import org.apache.isis.core.metamodel.specloader.collectiontyperegistry.CollectionTypeRegistryDefault;
+import org.apache.isis.core.metamodel.specloader.traverser.SpecificationTraverser;
+import org.apache.isis.core.metamodel.specloader.traverser.SpecificationTraverserDefault;
+import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidator;
+import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidatorComposite;
+import org.apache.isis.core.progmodel.layout.dflt.MemberLayoutArrangerDefault;
+
+public final class JavaReflectorHelper {
+
+ @SuppressWarnings("unused")
+ private static final Logger LOG = Logger.getLogger(JavaReflectorHelper.class);
+
+ private JavaReflectorHelper(){}
+
+ public static SpecificationLoaderSpi createObjectReflector(
+ final ProgrammingModel programmingModel,
+ final ClassSubstitutorFactory classSubstitutorFactory,
+ final Collection<MetaModelRefiner> metaModelRefiners,
+ final Set<FacetDecorator> facetDecorators,
+ final MetaModelValidator mmv,
+ final IsisConfiguration configuration) {
+ final MemberLayoutArranger memberLayoutArranger = new MemberLayoutArrangerDefault();
+ final SpecificationTraverser specificationTraverser = new SpecificationTraverserDefault();
+ final CollectionTypeRegistry collectionTypeRegistry = new CollectionTypeRegistryDefault();
+ final ClassSubstitutor classSubstitutor = classSubstitutorFactory.createClassSubstitutor(configuration);
+
+ MetaModelValidatorComposite metaModelValidator = MetaModelValidatorComposite.asComposite(mmv);
+ for (MetaModelRefiner metaModelRefiner : metaModelRefiners) {
+ metaModelRefiner.refineProgrammingModel(programmingModel, configuration);
+ metaModelRefiner.refineMetaModelValidator(metaModelValidator, configuration);
+ }
+
+ // the programming model is itself also a MetaModelValidatorRefiner
+ if(!metaModelRefiners.contains(programmingModel)) {
+ programmingModel.refineMetaModelValidator(metaModelValidator, configuration);
+ }
+
+ return new ObjectReflectorDefault(configuration, classSubstitutor, collectionTypeRegistry, specificationTraverser, memberLayoutArranger, programmingModel, facetDecorators, metaModelValidator);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/JavaReflectorInstallerNoDecorators.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/JavaReflectorInstallerNoDecorators.java b/framework/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/JavaReflectorInstallerNoDecorators.java
new file mode 100644
index 0000000..990600c
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/JavaReflectorInstallerNoDecorators.java
@@ -0,0 +1,213 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.progmodels.dflt;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+
+import org.apache.log4j.Logger;
+
+import org.apache.isis.core.commons.config.ConfigurationConstants;
+import org.apache.isis.core.commons.config.InstallerAbstract;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.commons.factory.InstanceUtil;
+import org.apache.isis.core.metamodel.facetapi.ClassSubstitutorFactory;
+import org.apache.isis.core.metamodel.facetapi.MetaModelRefiner;
+import org.apache.isis.core.metamodel.facetdecorator.FacetDecorator;
+import org.apache.isis.core.metamodel.facets.FacetFactory;
+import org.apache.isis.core.metamodel.layout.MemberLayoutArranger;
+import org.apache.isis.core.metamodel.progmodel.ProgrammingModel;
+import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
+import org.apache.isis.core.metamodel.specloader.FacetDecoratorInstaller;
+import org.apache.isis.core.metamodel.specloader.ObjectReflectorDefault;
+import org.apache.isis.core.metamodel.specloader.ObjectReflectorInstaller;
+import org.apache.isis.core.metamodel.specloader.ReflectorConstants;
+import org.apache.isis.core.metamodel.specloader.classsubstitutor.ClassSubstitutor;
+import org.apache.isis.core.metamodel.specloader.classsubstitutor.ClassSubstitutorComposite;
+import org.apache.isis.core.metamodel.specloader.collectiontyperegistry.CollectionTypeRegistry;
+import org.apache.isis.core.metamodel.specloader.collectiontyperegistry.CollectionTypeRegistryDefault;
+import org.apache.isis.core.metamodel.specloader.traverser.SpecificationTraverser;
+import org.apache.isis.core.metamodel.specloader.traverser.SpecificationTraverserDefault;
+import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidator;
+import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidatorComposite;
+import org.apache.isis.core.progmodel.layout.dflt.MemberLayoutArrangerDefault;
+
+/**
+ * An implementation of {@link ObjectReflectorInstaller} without support for {@link FacetDecoratorInstaller}
+ * being looked up (since this functionality is only available from <tt>runtimes.dflt</tt>).
+ */
+public class JavaReflectorInstallerNoDecorators extends InstallerAbstract implements ObjectReflectorInstaller {
+
+ private static final Logger LOG = Logger.getLogger(JavaReflectorInstallerNoDecorators.class);
+
+ public static final String PROPERTY_BASE = ConfigurationConstants.ROOT;
+
+ protected final LinkedHashSet<FacetDecoratorInstaller> decoratorInstallers = Sets.newLinkedHashSet();
+
+ // /////////////////////////////////////////////////////
+ // Constructor
+ // /////////////////////////////////////////////////////
+
+ public JavaReflectorInstallerNoDecorators() {
+ this("java");
+ }
+
+ public JavaReflectorInstallerNoDecorators(final String name) {
+ super(ObjectReflectorInstaller.TYPE, name);
+
+ }
+
+ // /////////////////////////////////////////////////////
+ // createReflector, doCreateReflector
+ // /////////////////////////////////////////////////////
+
+ /**
+ * Should call
+ * {@link #addFacetDecoratorInstaller(ReflectorDecoratorInstaller)} prior to
+ * calling this.
+ */
+ @Override
+ public SpecificationLoaderSpi createReflector(final ClassSubstitutorFactory classSubstitutorFactory, final Collection<MetaModelRefiner> metaModelRefiners) {
+
+ final ProgrammingModel programmingModel = createProgrammingModel(getConfiguration());
+ final Set<FacetDecorator> facetDecorators = createFacetDecorators(getConfiguration());
+ final MetaModelValidator mmv = createMetaModelValidator(getConfiguration());
+
+ return JavaReflectorHelper.createObjectReflector(programmingModel, classSubstitutorFactory, metaModelRefiners, facetDecorators, mmv, getConfiguration());
+ }
+
+
+ /**
+ * Hook method to allow subclasses to specify a different implementations
+ * (that is, sets of {@link ProgrammingModel} .
+ *
+ * <p>
+ * By default, looks up implementation from provided
+ * {@link IsisConfiguration} using
+ * {@link ReflectorConstants#PROGRAMMING_MODEL_FACETS_CLASS_NAME}. If not
+ * specified, then defaults to
+ * {@value ReflectorConstants#PROGRAMMING_MODEL_FACETS_CLASS_NAME_DEFAULT}.
+ *
+ * <p>
+ * The list of facets can be adjusted using
+ * {@link ReflectorConstants#FACET_FACTORY_INCLUDE_CLASS_NAME_LIST} to
+ * specify additional {@link FacetFactory factories} to include, and
+ * {@link ReflectorConstants#FACET_FACTORY_EXCLUDE_CLASS_NAME_LIST} to
+ * exclude.
+ */
+ protected ProgrammingModel createProgrammingModel(final IsisConfiguration configuration) {
+ final ProgrammingModel programmingModel = lookupAndCreateProgrammingModelFacets(configuration);
+ includeFacetFactories(configuration, programmingModel);
+ excludeFacetFactories(configuration, programmingModel);
+ return programmingModel;
+ }
+
+ private ProgrammingModel lookupAndCreateProgrammingModelFacets(final IsisConfiguration configuration) {
+ final String progModelFacetsClassName = configuration.getString(ReflectorConstants.PROGRAMMING_MODEL_FACETS_CLASS_NAME, ReflectorConstants.PROGRAMMING_MODEL_FACETS_CLASS_NAME_DEFAULT);
+ final ProgrammingModel programmingModel = InstanceUtil.createInstance(progModelFacetsClassName, ProgrammingModel.class);
+ return programmingModel;
+ }
+
+ /**
+ * Factored out of {@link #createProgrammingModel(IsisConfiguration)}
+ * so that subclasses that choose to override can still support
+ * customization of their {@link ProgrammingModel} in a similar way.
+ */
+ protected void includeFacetFactories(final IsisConfiguration configuration, final ProgrammingModel programmingModel) {
+ final String[] facetFactoriesIncludeClassNames = configuration.getList(ReflectorConstants.FACET_FACTORY_INCLUDE_CLASS_NAME_LIST);
+ if (facetFactoriesIncludeClassNames != null) {
+ for (final String facetFactoryClassName : facetFactoriesIncludeClassNames) {
+ final Class<? extends FacetFactory> facetFactory = InstanceUtil.loadClass(facetFactoryClassName, FacetFactory.class);
+ programmingModel.addFactory(facetFactory);
+ }
+ }
+ }
+
+ /**
+ * Factored out of {@link #createProgrammingModel(IsisConfiguration)}
+ * so that subclasses that choose to override can still support
+ * customization of their {@link ProgrammingModel} in a similar way.
+ */
+ protected void excludeFacetFactories(final IsisConfiguration configuration, final ProgrammingModel programmingModel) {
+ final String[] facetFactoriesExcludeClassNames = configuration.getList(ReflectorConstants.FACET_FACTORY_EXCLUDE_CLASS_NAME_LIST);
+ for (final String facetFactoryClassName : facetFactoriesExcludeClassNames) {
+ final Class<? extends FacetFactory> facetFactory = InstanceUtil.loadClass(facetFactoryClassName, FacetFactory.class);
+ programmingModel.removeFactory(facetFactory);
+ }
+ }
+
+ /**
+ * Hook method to allow subclasses to specify a different sets of
+ * {@link FacetDecorator}s.
+ */
+ protected Set<FacetDecorator> createFacetDecorators(final IsisConfiguration configuration) {
+ return Collections.emptySet();
+ }
+
+
+ /**
+ * Hook method to allow subclasses to specify a different implementation of
+ * {@link MetaModelValidator}.
+ *
+ * <p>
+ * By default, looks up implementation from provided
+ * {@link IsisConfiguration} using
+ * {@link ReflectorConstants#META_MODEL_VALIDATOR_CLASS_NAME}. If not
+ * specified, then defaults to
+ * {@value ReflectorConstants#META_MODEL_VALIDATOR_CLASS_NAME_DEFAULT}.
+ */
+ protected MetaModelValidator createMetaModelValidator(final IsisConfiguration configuration) {
+ final String metaModelValidatorClassName = configuration.getString(ReflectorConstants.META_MODEL_VALIDATOR_CLASS_NAME, ReflectorConstants.META_MODEL_VALIDATOR_CLASS_NAME_DEFAULT);
+ return InstanceUtil.createInstance(metaModelValidatorClassName, MetaModelValidator.class);
+ }
+
+
+
+ // /////////////////////////////////////////////////////
+ // Optionally Injected: DecoratorInstallers
+ // /////////////////////////////////////////////////////
+
+ /**
+ * Adds in {@link FacetDecoratorInstaller}; if <tt>null</tt> or if already
+ * added then request will be silently ignored.
+ */
+ @Override
+ public void addFacetDecoratorInstaller(final FacetDecoratorInstaller decoratorInstaller) {
+ if (decoratorInstaller == null) {
+ return;
+ }
+ decoratorInstallers.add(decoratorInstaller);
+ }
+
+ // /////////////////////////////////////////////////////
+ // Guice
+ // /////////////////////////////////////////////////////
+
+ @Override
+ public List<Class<?>> getTypes() {
+ return listOf(SpecificationLoaderSpi.class);
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/ProgrammingModelFacetsJava5.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/ProgrammingModelFacetsJava5.java b/framework/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/ProgrammingModelFacetsJava5.java
new file mode 100644
index 0000000..dd5fded
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/ProgrammingModelFacetsJava5.java
@@ -0,0 +1,440 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.progmodels.dflt;
+
+import org.apache.isis.core.metamodel.progmodel.ProgrammingModelAbstract;
+import org.apache.isis.core.progmodel.facets.actions.debug.annotation.DebugAnnotationFacetFactory;
+import org.apache.isis.core.progmodel.facets.actions.defaults.method.ActionDefaultsFacetFactory;
+import org.apache.isis.core.progmodel.facets.actions.exploration.annotation.ExplorationAnnotationFacetFactory;
+import org.apache.isis.core.progmodel.facets.actions.invoke.ActionInvocationFacetFactory;
+import org.apache.isis.core.progmodel.facets.actions.notcontributed.annotation.NotContributedAnnotationFacetFactory;
+import org.apache.isis.core.progmodel.facets.actions.notinservicemenu.annotation.NotInServiceMenuAnnotationFacetFactory;
+import org.apache.isis.core.progmodel.facets.actions.notinservicemenu.method.NotInServiceMenuMethodFacetFactory;
+import org.apache.isis.core.progmodel.facets.actions.prototype.annotation.PrototypeAnnotationFacetFactory;
+import org.apache.isis.core.progmodel.facets.actions.semantics.ActionSemanticsAnnotationFacetFactory;
+import org.apache.isis.core.progmodel.facets.actions.semantics.ActionSemanticsFallbackFacetFactory;
+import org.apache.isis.core.progmodel.facets.actions.semantics.IdempotentAnnotationFacetFactory;
+import org.apache.isis.core.progmodel.facets.actions.semantics.QueryOnlyAnnotationFacetFactory;
+import org.apache.isis.core.progmodel.facets.actions.typeof.annotation.TypeOfAnnotationForActionsFacetFactory;
+import org.apache.isis.core.progmodel.facets.actions.validate.method.ActionValidationFacetViaValidateMethodFacetFactory;
+import org.apache.isis.core.progmodel.facets.collections.accessor.CollectionAccessorFacetFactory;
+import org.apache.isis.core.progmodel.facets.collections.aggregated.ParentedSinceCollectionFacetFactory;
+import org.apache.isis.core.progmodel.facets.collections.clear.CollectionClearFacetFactory;
+import org.apache.isis.core.progmodel.facets.collections.collection.CollectionFacetFactory;
+import org.apache.isis.core.progmodel.facets.collections.disabled.fromimmutable.DisabledFacetForCollectionDerivedFromImmutableTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.collections.modify.CollectionAddRemoveAndValidateFacetFactory;
+import org.apache.isis.core.progmodel.facets.collections.notpersisted.annotation.NotPersistedAnnotationForCollectionFacetFactory;
+import org.apache.isis.core.progmodel.facets.collections.typeof.TypeOfAnnotationForCollectionsFacetFactory;
+import org.apache.isis.core.progmodel.facets.fallback.FallbackFacetFactory;
+import org.apache.isis.core.progmodel.facets.members.describedas.annotation.DescribedAsAnnotationOnMemberFacetFactory;
+import org.apache.isis.core.progmodel.facets.members.describedas.staticmethod.DescribedAsFacetViaDescriptionMethodFacetFactory;
+import org.apache.isis.core.progmodel.facets.members.disabled.annotation.DisabledAnnotationFacetFactory;
+import org.apache.isis.core.progmodel.facets.members.disabled.forsession.DisabledFacetViaDisableForSessionMethodFacetFactory;
+import org.apache.isis.core.progmodel.facets.members.disabled.method.DisabledFacetViaDisableMethodFacetFactory;
+import org.apache.isis.core.progmodel.facets.members.disabled.staticmethod.DisabledFacetViaProtectMethodFacetFactory;
+import org.apache.isis.core.progmodel.facets.members.hidden.annotation.HiddenAnnotationForMemberFacetFactory;
+import org.apache.isis.core.progmodel.facets.members.hidden.forsession.HiddenFacetViaHideForSessionMethodFacetFactory;
+import org.apache.isis.core.progmodel.facets.members.hidden.method.HiddenFacetViaHideMethodFacetFactory;
+import org.apache.isis.core.progmodel.facets.members.hidden.staticmethod.HiddenFacetViaAlwaysHideMethodFacetFactory;
+import org.apache.isis.core.progmodel.facets.members.named.annotation.NamedAnnotationOnMemberFacetFactory;
+import org.apache.isis.core.progmodel.facets.members.named.staticmethod.NamedFacetViaNameMethodFacetFactory;
+import org.apache.isis.core.progmodel.facets.members.order.MemberOrderAnnotationFacetFactory;
+import org.apache.isis.core.progmodel.facets.members.resolve.ResolveAnnotationFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.aggregated.annotation.AggregatedAnnotationFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.autocomplete.annotation.AutoCompleteAnnotationFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.bounded.annotation.BoundedAnnotationFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.bounded.markerifc.BoundedMarkerInterfaceFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.callbacks.create.CreatedCallbackFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.callbacks.load.LoadCallbackFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.callbacks.persist.PersistCallbackFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.callbacks.persist.PersistCallbackViaSaveMethodFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.callbacks.remove.RemoveCallbackFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.callbacks.update.UpdateCallbackFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.choices.enums.EnumFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.defaults.annotation.DefaultedAnnotationFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.describedas.annotation.DescribedAsAnnotationOnTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.dirty.method.DirtyMethodsFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.disabled.method.DisabledObjectViaDisabledMethodFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.encodeable.EncodableAnnotationFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.facets.annotation.FacetsAnnotationFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.hidden.HiddenAnnotationForTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.hidden.method.HiddenObjectViaHiddenMethodFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.icon.method.IconMethodFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.ignore.annotation.RemoveProgrammaticOrIgnoreAnnotationMethodsFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.ignore.isis.RemoveSetDomainObjectContainerMethodFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.ignore.isis.RemoveStaticGettersAndSettersFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.ignore.javalang.IteratorFilteringFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.ignore.javalang.RemoveGetClassMethodFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.ignore.javalang.RemoveInitMethodFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.ignore.javalang.RemoveJavaLangComparableMethodsFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.ignore.javalang.RemoveJavaLangObjectMethodsFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.ignore.javalang.RemoveSuperclassMethodsFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.ignore.javalang.SyntheticMethodFilteringFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.ignore.jdo.RemoveJdoEnhancementTypesFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.immutable.annotation.ImmutableAnnotationFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.immutable.markerifc.ImmutableMarkerInterfaceFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.mask.annotation.MaskAnnotationForTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.maxlen.annotation.MaxLengthAnnotationForTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.membergroups.annotation.MemberGroupsAnnotationElseFallbackFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.multiline.annotation.MultiLineAnnotationOnTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.named.annotation.NamedAnnotationOnTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.named.staticmethod.NamedFacetViaSingularNameStaticMethodFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.notpersistable.NotPersistableAnnotationFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.notpersistable.NotPersistableMarkerInterfacesFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.objecttype.ObjectSpecIdAnnotationFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.objecttype.ObjectTypeDerivedFromClassNameFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.orderactions.ActionOrderAnnotationFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.orderfields.FieldOrderAnnotationFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.parseable.ParseableFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.plural.annotation.PluralAnnotationFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.plural.staticmethod.PluralMethodFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.regex.annotation.RegExFacetAnnotationForTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.title.TitleMethodFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.title.annotation.TitleAnnotationFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.typicallen.annotation.TypicalLengthAnnotationOnTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.validate.method.ValidateObjectViaValidateMethodFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.validperspec.MustSatisfySpecificationOnTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.validprops.ObjectValidPropertiesFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.value.annotation.ValueFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.viewmodel.annotation.ViewModelAnnotationFacetFactory;
+import org.apache.isis.core.progmodel.facets.paged.PagedAnnotationOnCollectionFacetFactory;
+import org.apache.isis.core.progmodel.facets.paged.PagedAnnotationOnTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.param.choices.enums.ParameterChoicesFacetDerivedFromChoicesFacetFacetFactory;
+import org.apache.isis.core.progmodel.facets.param.choices.method.ActionChoicesFacetFactory;
+import org.apache.isis.core.progmodel.facets.param.choices.methodnum.ActionParameterChoicesFacetFactory;
+import org.apache.isis.core.progmodel.facets.param.defaults.fromtype.ParameterDefaultDerivedFromTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.param.defaults.methodnum.ActionParameterDefaultsFacetFactory;
+import org.apache.isis.core.progmodel.facets.param.describedas.annotation.DescribedAsAnnotationOnParameterFacetFactory;
+import org.apache.isis.core.progmodel.facets.param.mandatory.annotation.OptionalAnnotationForParameterFacetFactory;
+import org.apache.isis.core.progmodel.facets.param.mandatory.dflt.MandatoryDefaultForParametersFacetFactory;
+import org.apache.isis.core.progmodel.facets.param.multiline.annotation.MultiLineAnnotationOnParameterFacetFactory;
+import org.apache.isis.core.progmodel.facets.param.named.annotation.NamedAnnotationOnParameterFacetFactory;
+import org.apache.isis.core.progmodel.facets.param.typicallen.annotation.TypicalLengthAnnotationOnParameterFacetFactory;
+import org.apache.isis.core.progmodel.facets.param.typicallen.fromtype.TypicalLengthFacetForParameterDerivedFromTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.param.validate.maskannot.MaskAnnotationForParameterFacetFactory;
+import org.apache.isis.core.progmodel.facets.param.validate.maxlenannot.MaxLengthAnnotationForParameterFacetFactory;
+import org.apache.isis.core.progmodel.facets.param.validate.perspec.MustSatisfySpecificationOnParameterFacetFactory;
+import org.apache.isis.core.progmodel.facets.param.validate.regexannot.RegExFacetAnnotationForParameterFacetFactory;
+import org.apache.isis.core.progmodel.facets.properties.accessor.PropertyAccessorFacetFactory;
+import org.apache.isis.core.progmodel.facets.properties.choices.enums.PropertyChoicesFacetDerivedFromChoicesFacetFacetFactory;
+import org.apache.isis.core.progmodel.facets.properties.choices.method.PropertyChoicesFacetFactory;
+import org.apache.isis.core.progmodel.facets.properties.defaults.fromtype.PropertyDefaultDerivedFromTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.properties.defaults.method.PropertyDefaultFacetFactory;
+import org.apache.isis.core.progmodel.facets.properties.disabled.fromimmutable.DisabledFacetForPropertyDerivedFromImmutableTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.properties.mandatory.annotation.OptionalAnnotationForPropertyFacetFactory;
+import org.apache.isis.core.progmodel.facets.properties.mandatory.dflt.MandatoryDefaultForPropertiesFacetFactory;
+import org.apache.isis.core.progmodel.facets.properties.mandatory.staticmethod.PropertyOptionalFacetFactory;
+import org.apache.isis.core.progmodel.facets.properties.modify.PropertyModifyFacetFactory;
+import org.apache.isis.core.progmodel.facets.properties.modify.PropertySetAndClearFacetFactory;
+import org.apache.isis.core.progmodel.facets.properties.multiline.annotation.MultiLineAnnotationOnPropertyFacetFactory;
+import org.apache.isis.core.progmodel.facets.properties.notpersisted.annotation.NotPersistedAnnotationForPropertyFacetFactory;
+import org.apache.isis.core.progmodel.facets.properties.typicallen.annotation.TypicalLengthAnnotationOnPropertyFacetFactory;
+import org.apache.isis.core.progmodel.facets.properties.typicallen.fromtype.TypicalLengthFacetForPropertyDerivedFromTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.properties.validate.PropertyValidateDefaultFacetFactory;
+import org.apache.isis.core.progmodel.facets.properties.validate.PropertyValidateFacetFactory;
+import org.apache.isis.core.progmodel.facets.properties.validate.maskannot.MaskAnnotationForPropertyFacetFactory;
+import org.apache.isis.core.progmodel.facets.properties.validate.maxlenannot.MaxLengthAnnotationForPropertyFacetFactory;
+import org.apache.isis.core.progmodel.facets.properties.validate.perspec.MustSatisfySpecificationOnPropertyFacetFactory;
+import org.apache.isis.core.progmodel.facets.properties.validate.regexannot.RegExFacetAnnotationForPropertyFacetFactory;
+import org.apache.isis.core.progmodel.facets.value.bigdecimal.BigDecimalValueTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.value.biginteger.BigIntegerValueTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.value.blobs.BlobValueTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.value.booleans.BooleanPrimitiveValueTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.value.booleans.BooleanWrapperValueTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.value.bytes.BytePrimitiveValueTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.value.bytes.ByteWrapperValueTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.value.chars.CharPrimitiveValueTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.value.chars.CharWrapperValueTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.value.clobs.ClobValueTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.value.color.ColorValueTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.value.date.DateValueTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.value.datejodalocal.JodaLocalDateValueTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.value.datesql.JavaSqlDateValueTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.value.datetime.DateTimeValueTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.value.datetimejoda.JodaDateTimeValueTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.value.datetimejodalocal.JodaLocalDateTimeValueTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.value.dateutil.JavaUtilDateValueTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.value.floats.FloatPrimitiveValueTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.value.floats.FloatWrapperValueTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.value.image.ImageValueTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.value.imageawt.JavaAwtImageValueTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.value.integer.IntPrimitiveValueTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.value.integer.IntWrapperValueTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.value.longs.DoublePrimitiveValueTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.value.longs.DoubleWrapperValueTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.value.longs.LongPrimitiveValueTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.value.longs.LongWrapperValueTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.value.money.MoneyValueTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.value.password.PasswordValueTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.value.percentage.PercentageValueTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.value.shortint.ShortPrimitiveValueTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.value.shortint.ShortWrapperValueTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.value.string.StringValueTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.value.time.TimeValueTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.value.timesql.JavaSqlTimeValueTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.value.timestamp.TimeStampValueTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.value.timestampsql.JavaSqlTimeStampValueTypeFacetFactory;
+
+public final class ProgrammingModelFacetsJava5 extends ProgrammingModelAbstract {
+
+ public ProgrammingModelFacetsJava5() {
+
+ // must be first, so any Facets created can be replaced by other
+ // FacetFactorys later.
+ addFactory(FallbackFacetFactory.class);
+ addFactory(ObjectTypeDerivedFromClassNameFacetFactory.class);
+
+ addFactory(IteratorFilteringFacetFactory.class);
+ addFactory(SyntheticMethodFilteringFacetFactory.class);
+ addFactory(RemoveSuperclassMethodsFacetFactory.class);
+ addFactory(RemoveJavaLangObjectMethodsFacetFactory.class);
+ addFactory(RemoveJavaLangComparableMethodsFacetFactory.class);
+ addFactory(RemoveSetDomainObjectContainerMethodFacetFactory.class);
+ addFactory(RemoveInitMethodFacetFactory.class);
+ addFactory(RemoveStaticGettersAndSettersFacetFactory.class);
+ addFactory(RemoveGetClassMethodFacetFactory.class);
+ addFactory(RemoveProgrammaticOrIgnoreAnnotationMethodsFacetFactory.class);
+ addFactory(RemoveJdoEnhancementTypesFacetFactory.class);
+
+ // must be before any other FacetFactories that install
+ // MandatoryFacet.class facets
+ addFactory(MandatoryDefaultForPropertiesFacetFactory.class);
+ addFactory(MandatoryDefaultForParametersFacetFactory.class);
+
+ addFactory(PropertyValidateDefaultFacetFactory.class);
+
+ // enum support
+ addFactory(EnumFacetFactory.class);
+ addFactory(ParameterChoicesFacetDerivedFromChoicesFacetFacetFactory.class);
+ addFactory(PropertyChoicesFacetDerivedFromChoicesFacetFacetFactory.class);
+
+
+ // properties
+ addFactory(PropertyAccessorFacetFactory.class);
+ addFactory(PropertySetAndClearFacetFactory.class);
+ // must come after PropertySetAndClearFacetFactory
+ addFactory(PropertyModifyFacetFactory.class);
+
+ addFactory(PropertyValidateFacetFactory.class);
+ addFactory(PropertyChoicesFacetFactory.class);
+ addFactory(PropertyDefaultFacetFactory.class);
+ addFactory(PropertyOptionalFacetFactory.class);
+
+ // collections
+ addFactory(CollectionAccessorFacetFactory.class);
+ addFactory(CollectionClearFacetFactory.class);
+ addFactory(CollectionAddRemoveAndValidateFacetFactory.class);
+
+ // actions
+ addFactory(ActionInvocationFacetFactory.class);
+ addFactory(ActionValidationFacetViaValidateMethodFacetFactory.class);
+ addFactory(ActionChoicesFacetFactory.class);
+ addFactory(ActionParameterChoicesFacetFactory.class);
+ addFactory(ActionDefaultsFacetFactory.class);
+ addFactory(ActionParameterDefaultsFacetFactory.class);
+ addFactory(QueryOnlyAnnotationFacetFactory.class);
+ addFactory(IdempotentAnnotationFacetFactory.class);
+ addFactory(ActionSemanticsAnnotationFacetFactory.class);
+ addFactory(ActionSemanticsFallbackFacetFactory.class);
+
+ // members in general
+ addFactory(NamedFacetViaNameMethodFacetFactory.class);
+ addFactory(DescribedAsFacetViaDescriptionMethodFacetFactory.class);
+ addFactory(DisabledFacetViaDisableForSessionMethodFacetFactory.class);
+ addFactory(DisabledFacetViaDisableMethodFacetFactory.class);
+ addFactory(DisabledFacetViaProtectMethodFacetFactory.class);
+ addFactory(HiddenFacetViaHideForSessionMethodFacetFactory.class);
+ addFactory(HiddenFacetViaAlwaysHideMethodFacetFactory.class);
+ addFactory(HiddenFacetViaHideMethodFacetFactory.class);
+ addFactory(ResolveAnnotationFacetFactory.class);
+
+ // objects
+ addFactory(ObjectSpecIdAnnotationFacetFactory.class);
+ addFactory(IconMethodFacetFactory.class);
+
+ addFactory(CreatedCallbackFacetFactory.class);
+ addFactory(LoadCallbackFacetFactory.class);
+ addFactory(PersistCallbackViaSaveMethodFacetFactory.class);
+ addFactory(PersistCallbackFacetFactory.class);
+ addFactory(UpdateCallbackFacetFactory.class);
+ addFactory(RemoveCallbackFacetFactory.class);
+
+ addFactory(DirtyMethodsFacetFactory.class);
+ addFactory(ValidateObjectViaValidateMethodFacetFactory.class);
+ addFactory(ObjectValidPropertiesFacetFactory.class);
+ addFactory(PluralMethodFacetFactory.class);
+ addFactory(NamedFacetViaSingularNameStaticMethodFacetFactory.class);
+ addFactory(TitleAnnotationFacetFactory.class);
+ addFactory(TitleMethodFacetFactory.class);
+
+ addFactory(MemberOrderAnnotationFacetFactory.class);
+ addFactory(ActionOrderAnnotationFacetFactory.class);
+ addFactory(FieldOrderAnnotationFacetFactory.class);
+ addFactory(MemberGroupsAnnotationElseFallbackFacetFactory.class);
+
+ addFactory(AggregatedAnnotationFacetFactory.class);
+ addFactory(BoundedAnnotationFacetFactory.class);
+ addFactory(BoundedMarkerInterfaceFacetFactory.class);
+ addFactory(DebugAnnotationFacetFactory.class);
+
+ addFactory(DefaultedAnnotationFacetFactory.class);
+ addFactory(PropertyDefaultDerivedFromTypeFacetFactory.class);
+ addFactory(ParameterDefaultDerivedFromTypeFacetFactory.class);
+
+ addFactory(DescribedAsAnnotationOnTypeFacetFactory.class);
+ addFactory(DescribedAsAnnotationOnMemberFacetFactory.class);
+ addFactory(DescribedAsAnnotationOnParameterFacetFactory.class);
+
+ addFactory(DisabledAnnotationFacetFactory.class);
+ addFactory(EncodableAnnotationFacetFactory.class);
+ addFactory(ExplorationAnnotationFacetFactory.class);
+ addFactory(PrototypeAnnotationFacetFactory.class);
+ addFactory(NotContributedAnnotationFacetFactory.class);
+ addFactory(NotInServiceMenuAnnotationFacetFactory.class);
+ addFactory(NotInServiceMenuMethodFacetFactory.class);
+
+ addFactory(HiddenAnnotationForTypeFacetFactory.class);
+ // must come after the TitleAnnotationFacetFactory, because can act as an override
+ addFactory(HiddenAnnotationForMemberFacetFactory.class);
+
+ addFactory(HiddenObjectViaHiddenMethodFacetFactory.class);
+ addFactory(DisabledObjectViaDisabledMethodFacetFactory.class);
+
+ addFactory(ImmutableAnnotationFacetFactory.class);
+ addFactory(DisabledFacetForPropertyDerivedFromImmutableTypeFacetFactory.class);
+ addFactory(DisabledFacetForCollectionDerivedFromImmutableTypeFacetFactory.class);
+
+ addFactory(ImmutableMarkerInterfaceFacetFactory.class);
+
+ addFactory(ViewModelAnnotationFacetFactory.class);
+
+ addFactory(MaxLengthAnnotationForTypeFacetFactory.class);
+ addFactory(MaxLengthAnnotationForPropertyFacetFactory.class);
+ addFactory(MaxLengthAnnotationForParameterFacetFactory.class);
+
+ addFactory(MustSatisfySpecificationOnTypeFacetFactory.class);
+ addFactory(MustSatisfySpecificationOnPropertyFacetFactory.class);
+ addFactory(MustSatisfySpecificationOnParameterFacetFactory.class);
+
+ addFactory(MultiLineAnnotationOnTypeFacetFactory.class);
+ addFactory(MultiLineAnnotationOnPropertyFacetFactory.class);
+ addFactory(MultiLineAnnotationOnParameterFacetFactory.class);
+
+ addFactory(NamedAnnotationOnTypeFacetFactory.class);
+ addFactory(NamedAnnotationOnMemberFacetFactory.class);
+ addFactory(NamedAnnotationOnParameterFacetFactory.class);
+
+ addFactory(NotPersistableAnnotationFacetFactory.class);
+ addFactory(NotPersistableMarkerInterfacesFacetFactory.class);
+
+ addFactory(NotPersistedAnnotationForCollectionFacetFactory.class);
+ addFactory(NotPersistedAnnotationForPropertyFacetFactory.class);
+
+ addFactory(OptionalAnnotationForPropertyFacetFactory.class);
+ addFactory(OptionalAnnotationForParameterFacetFactory.class);
+
+ addFactory(ParseableFacetFactory.class);
+ addFactory(PluralAnnotationFacetFactory.class);
+ addFactory(PagedAnnotationOnTypeFacetFactory.class);
+ addFactory(PagedAnnotationOnCollectionFacetFactory.class);
+
+ addFactory(AutoCompleteAnnotationFacetFactory.class);
+
+ // must come after any facets that install titles
+ addFactory(MaskAnnotationForTypeFacetFactory.class);
+ addFactory(MaskAnnotationForPropertyFacetFactory.class);
+ addFactory(MaskAnnotationForParameterFacetFactory.class);
+
+ // must come after any facets that install titles, and after mask
+ // if takes precedence over mask.
+ addFactory(RegExFacetAnnotationForTypeFacetFactory.class);
+ addFactory(RegExFacetAnnotationForPropertyFacetFactory.class);
+ addFactory(RegExFacetAnnotationForParameterFacetFactory.class);
+
+ addFactory(TypeOfAnnotationForCollectionsFacetFactory.class);
+ addFactory(TypeOfAnnotationForActionsFacetFactory.class);
+
+ addFactory(TypicalLengthFacetForPropertyDerivedFromTypeFacetFactory.class);
+ addFactory(TypicalLengthFacetForParameterDerivedFromTypeFacetFactory.class);
+
+ addFactory(TypicalLengthAnnotationOnTypeFacetFactory.class);
+ addFactory(TypicalLengthAnnotationOnPropertyFacetFactory.class);
+ addFactory(TypicalLengthAnnotationOnParameterFacetFactory.class);
+
+ // built-in value types for Java language
+ addFactory(BooleanPrimitiveValueTypeFacetFactory.class);
+ addFactory(BooleanWrapperValueTypeFacetFactory.class);
+ addFactory(BytePrimitiveValueTypeFacetFactory.class);
+ addFactory(ByteWrapperValueTypeFacetFactory.class);
+ addFactory(ShortPrimitiveValueTypeFacetFactory.class);
+ addFactory(ShortWrapperValueTypeFacetFactory.class);
+ addFactory(IntPrimitiveValueTypeFacetFactory.class);
+ addFactory(IntWrapperValueTypeFacetFactory.class);
+ addFactory(LongPrimitiveValueTypeFacetFactory.class);
+ addFactory(LongWrapperValueTypeFacetFactory.class);
+ addFactory(FloatPrimitiveValueTypeFacetFactory.class);
+ addFactory(FloatWrapperValueTypeFacetFactory.class);
+ addFactory(DoublePrimitiveValueTypeFacetFactory.class);
+ addFactory(DoubleWrapperValueTypeFacetFactory.class);
+ addFactory(CharPrimitiveValueTypeFacetFactory.class);
+ addFactory(CharWrapperValueTypeFacetFactory.class);
+ addFactory(BigIntegerValueTypeFacetFactory.class);
+ addFactory(BigDecimalValueTypeFacetFactory.class);
+ addFactory(JavaSqlDateValueTypeFacetFactory.class);
+ addFactory(JavaSqlTimeValueTypeFacetFactory.class);
+ addFactory(JavaUtilDateValueTypeFacetFactory.class);
+ addFactory(JavaSqlTimeStampValueTypeFacetFactory.class);
+ addFactory(StringValueTypeFacetFactory.class);
+
+ addFactory(JavaAwtImageValueTypeFacetFactory.class);
+
+ // applib values
+ addFactory(BlobValueTypeFacetFactory.class);
+ addFactory(ClobValueTypeFacetFactory.class);
+ addFactory(DateValueTypeFacetFactory.class);
+ addFactory(DateTimeValueTypeFacetFactory.class);
+ addFactory(ColorValueTypeFacetFactory.class);
+ addFactory(MoneyValueTypeFacetFactory.class);
+ addFactory(PasswordValueTypeFacetFactory.class);
+ addFactory(PercentageValueTypeFacetFactory.class);
+ addFactory(TimeStampValueTypeFacetFactory.class);
+ addFactory(TimeValueTypeFacetFactory.class);
+ addFactory(ImageValueTypeFacetFactory.class);
+
+ // jodatime values
+ addFactory(JodaLocalDateValueTypeFacetFactory.class);
+ addFactory(JodaLocalDateTimeValueTypeFacetFactory.class);
+ addFactory(JodaDateTimeValueTypeFacetFactory.class);
+
+ // written to not trample over TypeOf if already installed
+ addFactory(CollectionFacetFactory.class);
+ // must come after CollectionFacetFactory
+ addFactory(ParentedSinceCollectionFacetFactory.class);
+
+ // so we can dogfood the NO applib "value" types
+ addFactory(ValueFacetFactory.class);
+
+ addFactory(FacetsAnnotationFacetFactory.class);
+ }
+
+
+
+
+}