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 2011/05/03 08:22:23 UTC
svn commit: r1098935 [10/20] - in /incubator/isis/trunk/runtimes/dflt:
bytecode/dflt/src/main/java/org/apache/isis/runtimes/dflt/bytecode/dflt/classsubstitutor/
bytecode/dflt/src/main/java/org/apache/isis/runtimes/dflt/bytecode/dflt/objectfactory/
byte...
Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerUserProfileStore.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerUserProfileStore.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerUserProfileStore.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerUserProfileStore.java Tue May 3 06:22:09 2011
@@ -17,17 +17,15 @@
* under the License.
*/
+package org.apache.isis.runtimes.dflt.runtime.runner.opts;
-package org.apache.isis.runtimes.dflt.runtime.runner.opts;
-
import static org.apache.isis.runtimes.dflt.runtime.runner.Constants.USER_PROFILE_STORE_LONG_OPT;
import static org.apache.isis.runtimes.dflt.runtime.runner.Constants.USER_PROFILE_STORE_OPT;
-
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.Option;
-import org.apache.commons.cli.OptionBuilder;
-import org.apache.commons.cli.Options;
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.OptionBuilder;
+import org.apache.commons.cli.Options;
import org.apache.isis.core.commons.config.IsisConfigurationBuilder;
import org.apache.isis.core.runtime.optionhandler.BootPrinter;
import org.apache.isis.core.runtime.optionhandler.OptionHandlerAbstract;
@@ -35,37 +33,44 @@ import org.apache.isis.runtimes.dflt.run
import org.apache.isis.runtimes.dflt.runtime.runner.Constants;
import org.apache.isis.runtimes.dflt.runtime.system.SystemConstants;
import org.apache.isis.runtimes.dflt.runtime.userprofile.UserProfileStoreInstaller;
-
-public class OptionHandlerUserProfileStore extends OptionHandlerAbstract {
-
- private InstallerRepository installerRepository;
- private String userProfileStoreName;
- public OptionHandlerUserProfileStore(final InstallerRepository installerRepository) {
- this.installerRepository = installerRepository;
- }
-
- @SuppressWarnings("static-access")
- public void addOption(Options options) {
- Object[] persistenceMechanisms = installerRepository.getInstallers(UserProfileStoreInstaller.class);
- Option option = OptionBuilder.withArgName("name|class name").hasArg().withLongOpt(USER_PROFILE_STORE_LONG_OPT).withDescription(
- "user profile store to use: " + availableInstallers(persistenceMechanisms)
- + "; or class name").create(USER_PROFILE_STORE_OPT);
- options.addOption(option);
- }
-
- public boolean handle(CommandLine commandLine, BootPrinter bootPrinter, Options options) {
- userProfileStoreName = commandLine.getOptionValue(Constants.USER_PROFILE_STORE_OPT);
- return true;
- }
-
- public void primeConfigurationBuilder(
- IsisConfigurationBuilder isisConfigurationBuilder) {
- isisConfigurationBuilder.add(SystemConstants.PROFILE_PERSISTOR_INSTALLER_KEY, userProfileStoreName);
- }
-
- public String getUserProfileStoreName() {
- return userProfileStoreName;
- }
-
-}
-
+
+public class OptionHandlerUserProfileStore extends OptionHandlerAbstract {
+
+ private final InstallerRepository installerRepository;
+ private String userProfileStoreName;
+
+ public OptionHandlerUserProfileStore(final InstallerRepository installerRepository) {
+ this.installerRepository = installerRepository;
+ }
+
+ @Override
+ @SuppressWarnings("static-access")
+ public void addOption(final Options options) {
+ final Object[] persistenceMechanisms = installerRepository.getInstallers(UserProfileStoreInstaller.class);
+ final Option option =
+ OptionBuilder
+ .withArgName("name|class name")
+ .hasArg()
+ .withLongOpt(USER_PROFILE_STORE_LONG_OPT)
+ .withDescription(
+ "user profile store to use: " + availableInstallers(persistenceMechanisms) + "; or class name")
+ .create(USER_PROFILE_STORE_OPT);
+ options.addOption(option);
+ }
+
+ @Override
+ public boolean handle(final CommandLine commandLine, final BootPrinter bootPrinter, final Options options) {
+ userProfileStoreName = commandLine.getOptionValue(Constants.USER_PROFILE_STORE_OPT);
+ return true;
+ }
+
+ @Override
+ public void primeConfigurationBuilder(final IsisConfigurationBuilder isisConfigurationBuilder) {
+ isisConfigurationBuilder.add(SystemConstants.PROFILE_PERSISTOR_INSTALLER_KEY, userProfileStoreName);
+ }
+
+ public String getUserProfileStoreName() {
+ return userProfileStoreName;
+ }
+
+}
Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerVerbose.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerVerbose.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerVerbose.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerVerbose.java Tue May 3 06:22:09 2011
@@ -17,38 +17,36 @@
* under the License.
*/
+package org.apache.isis.runtimes.dflt.runtime.runner.opts;
-package org.apache.isis.runtimes.dflt.runtime.runner.opts;
-
import static org.apache.isis.runtimes.dflt.runtime.runner.Constants.VERBOSE_OPT;
-
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.Options;
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Options;
import org.apache.isis.core.commons.config.IsisConfigurationBuilder;
import org.apache.isis.core.runtime.optionhandler.BootPrinter;
import org.apache.isis.core.runtime.optionhandler.OptionHandlerAbstract;
-import org.apache.isis.runtimes.dflt.runtime.system.SystemConstants;
-
-public class OptionHandlerVerbose extends OptionHandlerAbstract {
-
- public OptionHandlerVerbose() {
- super();
- }
-
- public void addOption(Options options) {
- options.addOption(VERBOSE_OPT, false, "print information, warning and error messages");
- }
-
- public boolean handle(CommandLine commandLine, BootPrinter bootPrinter, Options options) {
- return true;
- }
-
- public void primeConfigurationBuilder(
- IsisConfigurationBuilder isisConfigurationBuilder) {
- // TODO need to do what, exactly???
-
- }
-
-
-}
+
+public class OptionHandlerVerbose extends OptionHandlerAbstract {
+
+ public OptionHandlerVerbose() {
+ super();
+ }
+
+ @Override
+ public void addOption(final Options options) {
+ options.addOption(VERBOSE_OPT, false, "print information, warning and error messages");
+ }
+
+ @Override
+ public boolean handle(final CommandLine commandLine, final BootPrinter bootPrinter, final Options options) {
+ return true;
+ }
+
+ @Override
+ public void primeConfigurationBuilder(final IsisConfigurationBuilder isisConfigurationBuilder) {
+ // TODO need to do what, exactly???
+
+ }
+
+}
Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerVersion.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerVersion.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerVersion.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerVersion.java Tue May 3 06:22:09 2011
@@ -17,43 +17,41 @@
* under the License.
*/
+package org.apache.isis.runtimes.dflt.runtime.runner.opts;
-package org.apache.isis.runtimes.dflt.runtime.runner.opts;
-
import static org.apache.isis.runtimes.dflt.runtime.runner.Constants.VERSION_OPT;
-
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.Options;
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Options;
import org.apache.isis.core.commons.config.IsisConfigurationBuilder;
import org.apache.isis.core.runtime.optionhandler.BootPrinter;
import org.apache.isis.core.runtime.optionhandler.OptionHandlerAbstract;
import org.apache.isis.runtimes.dflt.runtime.runner.Constants;
-import org.apache.isis.runtimes.dflt.runtime.system.SystemConstants;
-
-public class OptionHandlerVersion extends OptionHandlerAbstract {
-
- public OptionHandlerVersion() {
- super();
- }
-
- public void addOption(Options options) {
- options.addOption(VERSION_OPT, false, "print version information");
- }
-
- public boolean handle(CommandLine commandLine, BootPrinter bootPrinter, Options options) {
- if (commandLine.hasOption(Constants.VERSION_OPT)) {
- bootPrinter.printVersion();
- return false;
- }
- return true;
- }
-
- public void primeConfigurationBuilder(
- IsisConfigurationBuilder isisConfigurationBuilder) {
- // nothing to do
-
- }
-
-
-}
+
+public class OptionHandlerVersion extends OptionHandlerAbstract {
+
+ public OptionHandlerVersion() {
+ super();
+ }
+
+ @Override
+ public void addOption(final Options options) {
+ options.addOption(VERSION_OPT, false, "print version information");
+ }
+
+ @Override
+ public boolean handle(final CommandLine commandLine, final BootPrinter bootPrinter, final Options options) {
+ if (commandLine.hasOption(Constants.VERSION_OPT)) {
+ bootPrinter.printVersion();
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public void primeConfigurationBuilder(final IsisConfigurationBuilder isisConfigurationBuilder) {
+ // nothing to do
+
+ }
+
+}
Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerViewer.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerViewer.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerViewer.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerViewer.java Tue May 3 06:22:09 2011
@@ -17,19 +17,17 @@
* under the License.
*/
+package org.apache.isis.runtimes.dflt.runtime.runner.opts;
-package org.apache.isis.runtimes.dflt.runtime.runner.opts;
-
import static org.apache.isis.runtimes.dflt.runtime.runner.Constants.VIEWER_LONG_OPT;
import static org.apache.isis.runtimes.dflt.runtime.runner.Constants.VIEWER_OPT;
-
-import java.util.List;
-
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.Option;
-import org.apache.commons.cli.OptionBuilder;
-import org.apache.commons.cli.Options;
+import java.util.List;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.OptionBuilder;
+import org.apache.commons.cli.Options;
import org.apache.isis.core.commons.config.IsisConfigurationBuilder;
import org.apache.isis.core.commons.lang.ListUtils;
import org.apache.isis.core.runtime.optionhandler.BootPrinter;
@@ -38,37 +36,45 @@ import org.apache.isis.runtimes.dflt.run
import org.apache.isis.runtimes.dflt.runtime.installerregistry.installerapi.IsisViewerInstaller;
import org.apache.isis.runtimes.dflt.runtime.runner.Constants;
import org.apache.isis.runtimes.dflt.runtime.system.SystemConstants;
-
-public class OptionHandlerViewer extends OptionHandlerAbstract {
-
- private InstallerRepository installerRepository;
- private List<String> viewerNames;
- public OptionHandlerViewer(final InstallerRepository installerRepository) {
- this.installerRepository = installerRepository;
- }
-
- @SuppressWarnings("static-access")
- public void addOption(Options options) {
- Object[] viewers = installerRepository.getInstallers(IsisViewerInstaller.class);
- Option option = OptionBuilder.withArgName("name|class name").hasArg().withLongOpt(VIEWER_LONG_OPT).withDescription(
- "viewer to use, or for server to listen on: " + availableInstallers(viewers) + "; or class name").create(
- VIEWER_OPT);
- options.addOption(option);
-
- }
-
- public boolean handle(CommandLine commandLine, BootPrinter bootPrinter, Options options) {
- viewerNames = getOptionValues(commandLine, Constants.VIEWER_OPT);
- return true;
- }
-
- public void primeConfigurationBuilder(
- IsisConfigurationBuilder isisConfigurationBuilder) {
- isisConfigurationBuilder.add(SystemConstants.VIEWER_KEY, ListUtils.listToString(viewerNames));
- }
-
- public List<String> getViewerNames() {
- return viewerNames;
- }
-
-}
+
+public class OptionHandlerViewer extends OptionHandlerAbstract {
+
+ private final InstallerRepository installerRepository;
+ private List<String> viewerNames;
+
+ public OptionHandlerViewer(final InstallerRepository installerRepository) {
+ this.installerRepository = installerRepository;
+ }
+
+ @Override
+ @SuppressWarnings("static-access")
+ public void addOption(final Options options) {
+ final Object[] viewers = installerRepository.getInstallers(IsisViewerInstaller.class);
+ final Option option =
+ OptionBuilder
+ .withArgName("name|class name")
+ .hasArg()
+ .withLongOpt(VIEWER_LONG_OPT)
+ .withDescription(
+ "viewer to use, or for server to listen on: " + availableInstallers(viewers) + "; or class name")
+ .create(VIEWER_OPT);
+ options.addOption(option);
+
+ }
+
+ @Override
+ public boolean handle(final CommandLine commandLine, final BootPrinter bootPrinter, final Options options) {
+ viewerNames = getOptionValues(commandLine, Constants.VIEWER_OPT);
+ return true;
+ }
+
+ @Override
+ public void primeConfigurationBuilder(final IsisConfigurationBuilder isisConfigurationBuilder) {
+ isisConfigurationBuilder.add(SystemConstants.VIEWER_KEY, ListUtils.listToString(viewerNames));
+ }
+
+ public List<String> getViewerNames() {
+ return viewerNames;
+ }
+
+}
Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionValidator.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionValidator.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionValidator.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionValidator.java Tue May 3 06:22:09 2011
@@ -17,7 +17,6 @@
* under the License.
*/
-
package org.apache.isis.runtimes.dflt.runtime.runner.opts;
import org.apache.isis.applib.maybe.Maybe;
Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionValidatorForConnector.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionValidatorForConnector.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionValidatorForConnector.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionValidatorForConnector.java Tue May 3 06:22:09 2011
@@ -17,7 +17,6 @@
* under the License.
*/
-
package org.apache.isis.runtimes.dflt.runtime.runner.opts;
import java.util.List;
@@ -28,29 +27,19 @@ import org.apache.isis.runtimes.dflt.run
public final class OptionValidatorForConnector implements OptionValidator {
private final OptionHandlerConnector optionHandlerClientConnection;
- public OptionValidatorForConnector(
- OptionHandlerConnector optionHandlerClientConnection) {
+ public OptionValidatorForConnector(final OptionHandlerConnector optionHandlerClientConnection) {
this.optionHandlerClientConnection = optionHandlerClientConnection;
}
@Override
- public Maybe<String> validate(DeploymentType deploymentType) {
- List<String> connectorNames = optionHandlerClientConnection
- .getConnectorNames();
-
- boolean fail = !deploymentType
- .canSpecifyConnectors(connectorNames);
- String failMsg = String
- .format(
- "Error: cannot specify %s connector%s for deployment type %s\n",
- Strings.plural(connectorNames, "more than one",
- "any"), Strings.plural(
- connectorNames, "", "s"),
- deploymentType
- .nameLowerCase());
- return Maybe
- .setIf(
- fail,
- failMsg);
+ public Maybe<String> validate(final DeploymentType deploymentType) {
+ final List<String> connectorNames = optionHandlerClientConnection.getConnectorNames();
+
+ final boolean fail = !deploymentType.canSpecifyConnectors(connectorNames);
+ final String failMsg =
+ String.format("Error: cannot specify %s connector%s for deployment type %s\n",
+ Strings.plural(connectorNames, "more than one", "any"), Strings.plural(connectorNames, "", "s"),
+ deploymentType.nameLowerCase());
+ return Maybe.setIf(fail, failMsg);
}
}
\ No newline at end of file
Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionValidatorForPersistor.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionValidatorForPersistor.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionValidatorForPersistor.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionValidatorForPersistor.java Tue May 3 06:22:09 2011
@@ -17,36 +17,27 @@
* under the License.
*/
-
package org.apache.isis.runtimes.dflt.runtime.runner.opts;
import org.apache.isis.applib.maybe.Maybe;
import org.apache.isis.core.commons.lang.StringUtils;
import org.apache.isis.runtimes.dflt.runtime.system.DeploymentType;
-public final class OptionValidatorForPersistor implements
- OptionValidator {
+public final class OptionValidatorForPersistor implements OptionValidator {
private final OptionHandlerPersistor optionHandlerPersistor;
- public OptionValidatorForPersistor(
- OptionHandlerPersistor optionHandlerPersistor) {
+ public OptionValidatorForPersistor(final OptionHandlerPersistor optionHandlerPersistor) {
this.optionHandlerPersistor = optionHandlerPersistor;
}
@Override
- public Maybe<String> validate(DeploymentType deploymentType) {
- String objectPersistorName = optionHandlerPersistor
- .getPersistorName();
- boolean fail = (!StringUtils.isNullOrEmpty(objectPersistorName))
- && !deploymentType.canSpecifyObjectStore();
- String failMsg = String
- .format(
- "Error: cannot specify an object store (persistor) for deployment type %s\n",
- deploymentType.name()
- .toLowerCase());
- return Maybe
- .setIf(
- fail,
- failMsg);
+ public Maybe<String> validate(final DeploymentType deploymentType) {
+ final String objectPersistorName = optionHandlerPersistor.getPersistorName();
+ final boolean fail =
+ (!StringUtils.isNullOrEmpty(objectPersistorName)) && !deploymentType.canSpecifyObjectStore();
+ final String failMsg =
+ String.format("Error: cannot specify an object store (persistor) for deployment type %s\n", deploymentType
+ .name().toLowerCase());
+ return Maybe.setIf(fail, failMsg);
}
}
\ No newline at end of file
Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionValidatorForViewers.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionValidatorForViewers.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionValidatorForViewers.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionValidatorForViewers.java Tue May 3 06:22:09 2011
@@ -17,40 +17,29 @@
* under the License.
*/
-
package org.apache.isis.runtimes.dflt.runtime.runner.opts;
import java.util.List;
import org.apache.isis.applib.maybe.Maybe;
-import org.apache.isis.runtimes.dflt.runtime.runner.IsisRunner;
import org.apache.isis.runtimes.dflt.runtime.system.DeploymentType;
-public final class OptionValidatorForViewers implements
- OptionValidator {
+public final class OptionValidatorForViewers implements OptionValidator {
private final OptionHandlerViewer optionHandlerViewer;
- public OptionValidatorForViewers(
- OptionHandlerViewer optionHandlerViewer) {
+ public OptionValidatorForViewers(final OptionHandlerViewer optionHandlerViewer) {
this.optionHandlerViewer = optionHandlerViewer;
}
@Override
- public Maybe<String> validate(DeploymentType deploymentType) {
- List<String> viewerNames = optionHandlerViewer.getViewerNames();
+ public Maybe<String> validate(final DeploymentType deploymentType) {
+ final List<String> viewerNames = optionHandlerViewer.getViewerNames();
- boolean fail = !deploymentType.canSpecifyViewers(viewerNames);
- String failMsg = String
- .format(
- "Error: cannot specify %s viewer%s for deployment type %s\n",
- Strings.plural(viewerNames, "more than one",
- "any"), Strings.plural(
- viewerNames, "", "s"),
- deploymentType
- .nameLowerCase());
- return Maybe
- .setIf(
- fail,
- failMsg);
+ final boolean fail = !deploymentType.canSpecifyViewers(viewerNames);
+ final String failMsg =
+ String.format("Error: cannot specify %s viewer%s for deployment type %s\n",
+ Strings.plural(viewerNames, "more than one", "any"), Strings.plural(viewerNames, "", "s"),
+ deploymentType.nameLowerCase());
+ return Maybe.setIf(fail, failMsg);
}
}
\ No newline at end of file
Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionValidatorUserAndPasswordCombo.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionValidatorUserAndPasswordCombo.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionValidatorUserAndPasswordCombo.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionValidatorUserAndPasswordCombo.java Tue May 3 06:22:09 2011
@@ -17,30 +17,27 @@
* under the License.
*/
-
package org.apache.isis.runtimes.dflt.runtime.runner.opts;
import org.apache.isis.applib.maybe.Maybe;
import org.apache.isis.runtimes.dflt.runtime.system.DeploymentType;
-public final class OptionValidatorUserAndPasswordCombo implements
- OptionValidator {
-
+public final class OptionValidatorUserAndPasswordCombo implements OptionValidator {
+
private final OptionHandlerUser optionHandlerUser;
private final OptionHandlerPassword optionHandlerPassword;
- public OptionValidatorUserAndPasswordCombo(
- OptionHandlerUser optionHandlerUser,
- OptionHandlerPassword optionHandlerPassword) {
+ public OptionValidatorUserAndPasswordCombo(final OptionHandlerUser optionHandlerUser,
+ final OptionHandlerPassword optionHandlerPassword) {
this.optionHandlerPassword = optionHandlerPassword;
this.optionHandlerUser = optionHandlerUser;
}
@Override
- public Maybe<String> validate(DeploymentType deploymentType) {
- String user = optionHandlerUser.getUserName();
- String password = optionHandlerPassword.getPassword();
- boolean ok = (password == null && user == null) || (password != null && user != null);
+ public Maybe<String> validate(final DeploymentType deploymentType) {
+ final String user = optionHandlerUser.getUserName();
+ final String password = optionHandlerPassword.getPassword();
+ final boolean ok = (password == null && user == null) || (password != null && user != null);
return Maybe.notSetIf(ok, "A user name must be specified with a password");
}
}
\ No newline at end of file
Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/Strings.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/Strings.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/Strings.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/Strings.java Tue May 3 06:22:09 2011
@@ -17,17 +17,16 @@
* under the License.
*/
-
package org.apache.isis.runtimes.dflt.runtime.runner.opts;
import java.util.List;
final class Strings {
-
- private Strings(){}
- static String plural(List<String> collection, String moreThanOne,
- String ifNone) {
+ private Strings() {
+ }
+
+ static String plural(final List<String> collection, final String moreThanOne, final String ifNone) {
return (collection.size() > 1 ? moreThanOne : ifNone);
}
Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/services/RepositoryHelper.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/services/RepositoryHelper.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/services/RepositoryHelper.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/services/RepositoryHelper.java Tue May 3 06:22:09 2011
@@ -17,7 +17,6 @@
* under the License.
*/
-
package org.apache.isis.runtimes.dflt.runtime.services;
import java.util.ArrayList;
@@ -35,42 +34,39 @@ import org.apache.isis.runtimes.dflt.run
import org.apache.isis.runtimes.dflt.runtime.system.persistence.PersistenceQuery;
import org.apache.isis.runtimes.dflt.runtime.system.persistence.PersistenceSession;
-
public final class RepositoryHelper {
-
- private RepositoryHelper(){}
+
+ private RepositoryHelper() {
+ }
public static Object[] allInstances(final Class<?> cls) {
return allInstances(getSpecificationLoader().loadSpecification(cls), cls);
}
public static <T> Object[] allInstances(final ObjectSpecification spec, final Class<T> cls) {
- QueryFindAllInstances<T> query = new QueryFindAllInstances<T>(spec.getFullIdentifier());
+ final QueryFindAllInstances<T> query = new QueryFindAllInstances<T>(spec.getFullIdentifier());
final ObjectAdapter instances = getPersistenceSession().findInstances(query, QueryCardinality.MULTIPLE);
final Object[] array = convertToArray(instances, cls);
return array;
}
public static List<Object> findByPersistenceQuery(final PersistenceQuery persistenceQuery, final Class<?> cls) {
- final ObjectAdapter instances = getPersistenceSession().findInstances(persistenceQuery);
+ final ObjectAdapter instances = getPersistenceSession().findInstances(persistenceQuery);
return convertToList(instances, cls);
}
public static List<Object> findByTitle(final Class<?> type, final String title) {
- ObjectSpecification spec = getSpecificationLoader().loadSpecification(type);
+ final ObjectSpecification spec = getSpecificationLoader().loadSpecification(type);
return findByTitle(spec, type, title);
}
- public static List<Object> findByTitle(
- final ObjectSpecification spec,
- final Class<?> cls,
- final String title) {
+ public static List<Object> findByTitle(final ObjectSpecification spec, final Class<?> cls, final String title) {
final PersistenceQuery criteria = new PersistenceQueryFindByTitle(spec, title);
return findByPersistenceQuery(criteria, cls);
}
public static boolean hasInstances(final Class<?> type) {
- ObjectSpecification spec = getSpecificationLoader().loadSpecification(type);
+ final ObjectSpecification spec = getSpecificationLoader().loadSpecification(type);
return hasInstances(spec);
}
@@ -78,15 +74,14 @@ public final class RepositoryHelper {
return getPersistenceSession().hasInstances(spec);
}
-
- ///////////////////////////////////////////////////////////////////////
+ // /////////////////////////////////////////////////////////////////////
// Helpers
- ///////////////////////////////////////////////////////////////////////
-
+ // /////////////////////////////////////////////////////////////////////
+
private static List<Object> convertToList(final ObjectAdapter instances, final Class<?> cls) {
final CollectionFacet facet = CollectionFacetUtils.getCollectionFacetFromSpec(instances);
final List<Object> list = new ArrayList<Object>();
- for(final ObjectAdapter adapter: facet.iterable(instances)) {
+ for (final ObjectAdapter adapter : facet.iterable(instances)) {
list.add(adapter.getObject());
}
return list;
@@ -96,18 +91,16 @@ public final class RepositoryHelper {
return convertToList(instances, cls).toArray();
}
-
- ///////////////////////////////////////////////////////////////////////
+ // /////////////////////////////////////////////////////////////////////
// Context lookup
- ///////////////////////////////////////////////////////////////////////
+ // /////////////////////////////////////////////////////////////////////
- private static PersistenceSession getPersistenceSession() {
- return IsisContext.getPersistenceSession();
- }
-
- private static SpecificationLoader getSpecificationLoader() {
- return IsisContext.getSpecificationLoader();
- }
+ private static PersistenceSession getPersistenceSession() {
+ return IsisContext.getPersistenceSession();
+ }
+ private static SpecificationLoader getSpecificationLoader() {
+ return IsisContext.getSpecificationLoader();
+ }
}
Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/services/ServiceException.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/services/ServiceException.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/services/ServiceException.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/services/ServiceException.java Tue May 3 06:22:09 2011
@@ -17,12 +17,10 @@
* under the License.
*/
-
package org.apache.isis.runtimes.dflt.runtime.services;
import org.apache.isis.core.commons.exceptions.IsisException;
-
public class ServiceException extends IsisException {
private static final long serialVersionUID = 1L;
@@ -43,4 +41,3 @@ public class ServiceException extends Is
}
}
-
Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/services/ServicesInstaller.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/services/ServicesInstaller.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/services/ServicesInstaller.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/services/ServicesInstaller.java Tue May 3 06:22:09 2011
@@ -17,7 +17,6 @@
* under the License.
*/
-
package org.apache.isis.runtimes.dflt.runtime.services;
import java.util.List;
@@ -25,16 +24,13 @@ import java.util.List;
import org.apache.isis.core.commons.components.Installer;
import org.apache.isis.runtimes.dflt.runtime.system.DeploymentType;
-
public interface ServicesInstaller extends Installer {
-
- /**
- * NB: this has the suffix '-installer' because in the command line we must
- * distinguish from the '--services' flag meaning a particular set of services to use
- * (whereas this flag means how to locate them).
- */
- static String TYPE = "services-installer";
+
+ /**
+ * NB: this has the suffix '-installer' because in the command line we must distinguish from the '--services' flag
+ * meaning a particular set of services to use (whereas this flag means how to locate them).
+ */
+ static String TYPE = "services-installer";
List<Object> getServices(DeploymentType deploymentType);
}
-
Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/services/ServicesInstallerAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/services/ServicesInstallerAbstract.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/services/ServicesInstallerAbstract.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/services/ServicesInstallerAbstract.java Tue May 3 06:22:09 2011
@@ -17,7 +17,6 @@
* under the License.
*/
-
package org.apache.isis.runtimes.dflt.runtime.services;
import static org.apache.isis.core.commons.lang.CastUtils.collectionOf;
@@ -29,15 +28,13 @@ import java.util.List;
import org.apache.isis.core.commons.config.InstallerAbstract;
import org.apache.isis.runtimes.dflt.runtime.system.DeploymentType;
-
-
public abstract class ServicesInstallerAbstract extends InstallerAbstract implements ServicesInstaller {
private final List<Object> services = new ArrayList<Object>();
- public ServicesInstallerAbstract(String name) {
- super(ServicesInstaller.TYPE, name);
+ public ServicesInstallerAbstract(final String name) {
+ super(ServicesInstaller.TYPE, name);
}
-
+
/**
* Add this service, automatically unravelling if is a {@link Collection} of services.
*
@@ -59,6 +56,7 @@ public abstract class ServicesInstallerA
addService(new SimpleRepository(cls));
}
+ @Override
public List<Object> getServices(final DeploymentType deploymentType) {
return services;
}
@@ -72,4 +70,3 @@ public abstract class ServicesInstallerA
}
}
-
Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/services/ServicesInstallerFromConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/services/ServicesInstallerFromConfiguration.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/services/ServicesInstallerFromConfiguration.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/services/ServicesInstallerFromConfiguration.java Tue May 3 06:22:09 2011
@@ -17,15 +17,12 @@
* under the License.
*/
-
package org.apache.isis.runtimes.dflt.runtime.services;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
-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;
@@ -36,7 +33,7 @@ import org.apache.isis.core.commons.lang
import org.apache.isis.runtimes.dflt.runtime.fixturedomainservice.ObjectFixtureService;
import org.apache.isis.runtimes.dflt.runtime.system.DeploymentType;
import org.apache.isis.runtimes.dflt.runtime.system.SystemConstants;
-
+import org.apache.log4j.Logger;
public class ServicesInstallerFromConfiguration extends InstallerAbstract implements ServicesInstaller {
@@ -49,19 +46,18 @@ public class ServicesInstallerFromConfig
private static final char DELIMITER = '#';
public ServicesInstallerFromConfiguration() {
- super(ServicesInstaller.TYPE, "configuration");
+ super(ServicesInstaller.TYPE, "configuration");
}
-
-
- public List<Object> getServices(
- final DeploymentType deploymentType) {
-
+
+ @Override
+ public List<Object> getServices(final DeploymentType deploymentType) {
+
LOG.info("installing " + this.getClass().getName());
final Object[] common = createServices(getConfiguration(), null);
final Object[] specific = createServices(getConfiguration(), deploymentType.name());
final Object[] combined = ArrayUtils.combine(common, specific);
if (combined.length == 0) {
- throw new InitialisationException("No services specified");
+ throw new InitialisationException("No services specified");
}
return ListUtils.asList(combined);
}
@@ -80,8 +76,9 @@ public class ServicesInstallerFromConfig
} else {
list = new ArrayList<Object>();
}
- if (configuration.getBoolean(root + EXPLORATION_OBJECTS) ){
- DeploymentType deploymentType = DeploymentType.lookup(configuration.getString(SystemConstants.DEPLOYMENT_TYPE_KEY));
+ if (configuration.getBoolean(root + EXPLORATION_OBJECTS)) {
+ final DeploymentType deploymentType =
+ DeploymentType.lookup(configuration.getString(SystemConstants.DEPLOYMENT_TYPE_KEY));
if (deploymentType.isExploring()) {
list.add(new ObjectFixtureService());
}
@@ -122,17 +119,17 @@ public class ServicesInstallerFromConfig
final int pos = name.indexOf(DELIMITER);
final String type = name.substring(0, pos);
if (!"repository".equals(type)) {
- throw new InitialisationException(String.format("Unknown service type '%s'", type));
+ throw new InitialisationException(String.format("Unknown service type '%s'", type));
}
final String className = prefix + name.substring(pos + 1);
-
+
final Class<?> underlying = loadClass(className);
return new SimpleRepository(underlying);
}
private Object createService(final String className) {
- Class<?> loadedClass = loadClass(className);
- return createInstance(loadedClass);
+ final Class<?> loadedClass = loadClass(className);
+ return createInstance(loadedClass);
}
private static String servicePrefix(final String servicePrefix) {
@@ -146,28 +143,29 @@ public class ServicesInstallerFromConfig
private static Class<?> loadClass(final String className) {
try {
LOG.debug("loading class for service: " + className);
- return Thread.currentThread().getContextClassLoader().loadClass(className);
+ return Thread.currentThread().getContextClassLoader().loadClass(className);
} catch (final ClassNotFoundException ex) {
throw new InitialisationException(String.format("Cannot find class '%s' for service", className));
}
}
-
+
private static <T> T createInstance(final Class<T> serviceType) {
try {
return serviceType.newInstance();
} catch (final NoClassDefFoundError e) {
- throw new InstanceCreationClassException("Class found '" + serviceType + "', but is missing a dependent class", e);
+ throw new InstanceCreationClassException("Class found '" + serviceType
+ + "', but is missing a dependent class", e);
} catch (final InstantiationException e) {
- throw new InstanceCreationException("Could not instantiate an object of class '" + serviceType.getName() + "'; "
- + e.getMessage());
+ throw new InstanceCreationException("Could not instantiate an object of class '" + serviceType.getName()
+ + "'; " + e.getMessage());
} catch (final IllegalAccessException e) {
- throw new InstanceCreationException("Could not access the class '" + serviceType.getName() + "'; " + e.getMessage());
+ throw new InstanceCreationException("Could not access the class '" + serviceType.getName() + "'; "
+ + e.getMessage());
}
}
-
@Override
public List<Class<?>> getTypes() {
- return listOf(List.class); // ie List<Object.class>, of services
+ return listOf(List.class); // ie List<Object.class>, of services
}
}
Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/services/SimpleRepository.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/services/SimpleRepository.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/services/SimpleRepository.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/services/SimpleRepository.java Tue May 3 06:22:09 2011
@@ -17,7 +17,6 @@
* under the License.
*/
-
package org.apache.isis.runtimes.dflt.runtime.services;
import org.apache.isis.core.commons.lang.ToString;
@@ -26,7 +25,6 @@ import org.apache.isis.core.metamodel.sp
import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
import org.apache.isis.runtimes.dflt.runtime.system.persistence.PersistenceSession;
-
public final class SimpleRepository {
private final Class<?> type;
@@ -124,7 +122,6 @@ public final class SimpleRepository {
return true;
}
-
// //////////////////////////////////////////////////////
// Dependencies (from singleton)
// //////////////////////////////////////////////////////
@@ -134,4 +131,3 @@ public final class SimpleRepository {
}
}
-
Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/services/package-info.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/services/package-info.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/services/package-info.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/services/package-info.java Tue May 3 06:22:09 2011
@@ -17,11 +17,10 @@
* under the License.
*/
-
-/**
- * Used to specify the set of services (including repositories) to inject into
- * domain objects.
- *
- * @see org.apache.isis.runtimes.dflt.runtime.fixtures.FixturesInstaller
- */
+/**
+ * Used to specify the set of services (including repositories) to inject into
+ * domain objects.
+ *
+ * @see org.apache.isis.runtimes.dflt.runtime.fixtures.FixturesInstaller
+ */
package org.apache.isis.runtimes.dflt.runtime.services;
\ No newline at end of file
Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/snapshot/XmlSnapshotBuilder.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/snapshot/XmlSnapshotBuilder.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/snapshot/XmlSnapshotBuilder.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/snapshot/XmlSnapshotBuilder.java Tue May 3 06:22:09 2011
@@ -16,86 +16,86 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.isis.runtimes.dflt.runtime.snapshot;
-
-import java.util.List;
-
-import org.apache.isis.applib.snapshot.Snapshottable;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.map.AdapterMap;
-import org.apache.isis.core.runtime.snapshot.XmlSchema;
-import org.apache.isis.core.runtime.snapshot.XmlSnapshot;
-import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
-import org.apache.isis.runtimes.dflt.runtime.system.persistence.PersistenceSession;
-
-import com.google.common.collect.Lists;
-
-/**
- * Builds an {@link XmlSnapshot} using a fluent use through
- * a builder:
- *
- * <pre>
- * XmlSnapshot snapshot =
- * XmlSnapshotBuilder.create(customer)
- * .includePath("placeOfBirth")
- * .includePath("orders/product")
- * .build();
- * Element customerAsXml = snapshot.toXml();
- * </pre>
- */
-public class XmlSnapshotBuilder {
-
- private final Snapshottable snapshottable;
- private XmlSchema schema;
- static class PathAndAnnotation {
- public PathAndAnnotation(String path, String annotation) {
- this.path = path;
- this.annotation = annotation;
- }
- private String path;
- private String annotation;
- }
- private List<XmlSnapshotBuilder.PathAndAnnotation> paths = Lists.newArrayList();
-
- public XmlSnapshotBuilder(Snapshottable domainObject) {
- this.snapshottable = domainObject;
- }
- public XmlSnapshotBuilder usingSchema(XmlSchema schema) {
- this.schema = schema;
- return this;
- }
- public XmlSnapshotBuilder includePath(String path) {
- return includePathAndAnnotation(path, null);
- }
- public XmlSnapshotBuilder includePathAndAnnotation(String path, String annotation) {
- paths.add(new PathAndAnnotation(path, annotation));
- return this;
- }
-
- public XmlSnapshot build() {
- ObjectAdapter adapter = getAdapterMap().adapterFor(snapshottable);
- XmlSnapshot snapshot = (schema != null) ?
- new XmlSnapshot(adapter, schema) :
- new XmlSnapshot(adapter);
- for(XmlSnapshotBuilder.PathAndAnnotation paa: paths) {
- if (paa.annotation != null) {
- snapshot.include(paa.path, paa.annotation);
- } else {
- snapshot.include(paa.path);
- }
- }
- return snapshot;
- }
-
- /////////////////////////////////////////////////////////
- // Dependencies (from context)
- /////////////////////////////////////////////////////////
-
- private static AdapterMap getAdapterMap() {
- return getPersistenceSession().getAdapterManager();
- }
-
- private static PersistenceSession getPersistenceSession() {
- return IsisContext.getPersistenceSession();
- }
+package org.apache.isis.runtimes.dflt.runtime.snapshot;
+
+import java.util.List;
+
+import org.apache.isis.applib.snapshot.Snapshottable;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.map.AdapterMap;
+import org.apache.isis.core.runtime.snapshot.XmlSchema;
+import org.apache.isis.core.runtime.snapshot.XmlSnapshot;
+import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
+import org.apache.isis.runtimes.dflt.runtime.system.persistence.PersistenceSession;
+
+import com.google.common.collect.Lists;
+
+/**
+ * Builds an {@link XmlSnapshot} using a fluent use through a builder:
+ *
+ * <pre>
+ * XmlSnapshot snapshot = XmlSnapshotBuilder.create(customer).includePath("placeOfBirth").includePath("orders/product")
+ * .build();
+ * Element customerAsXml = snapshot.toXml();
+ * </pre>
+ */
+public class XmlSnapshotBuilder {
+
+ private final Snapshottable snapshottable;
+ private XmlSchema schema;
+
+ static class PathAndAnnotation {
+ public PathAndAnnotation(final String path, final String annotation) {
+ this.path = path;
+ this.annotation = annotation;
+ }
+
+ private final String path;
+ private final String annotation;
+ }
+
+ private final List<XmlSnapshotBuilder.PathAndAnnotation> paths = Lists.newArrayList();
+
+ public XmlSnapshotBuilder(final Snapshottable domainObject) {
+ this.snapshottable = domainObject;
+ }
+
+ public XmlSnapshotBuilder usingSchema(final XmlSchema schema) {
+ this.schema = schema;
+ return this;
+ }
+
+ public XmlSnapshotBuilder includePath(final String path) {
+ return includePathAndAnnotation(path, null);
+ }
+
+ public XmlSnapshotBuilder includePathAndAnnotation(final String path, final String annotation) {
+ paths.add(new PathAndAnnotation(path, annotation));
+ return this;
+ }
+
+ public XmlSnapshot build() {
+ final ObjectAdapter adapter = getAdapterMap().adapterFor(snapshottable);
+ final XmlSnapshot snapshot = (schema != null) ? new XmlSnapshot(adapter, schema) : new XmlSnapshot(adapter);
+ for (final XmlSnapshotBuilder.PathAndAnnotation paa : paths) {
+ if (paa.annotation != null) {
+ snapshot.include(paa.path, paa.annotation);
+ } else {
+ snapshot.include(paa.path);
+ }
+ }
+ return snapshot;
+ }
+
+ // ///////////////////////////////////////////////////////
+ // Dependencies (from context)
+ // ///////////////////////////////////////////////////////
+
+ private static AdapterMap getAdapterMap() {
+ return getPersistenceSession().getAdapterManager();
+ }
+
+ private static PersistenceSession getPersistenceSession() {
+ return IsisContext.getPersistenceSession();
+ }
}
\ No newline at end of file
Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/ContextCategory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/ContextCategory.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/ContextCategory.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/ContextCategory.java Tue May 3 06:22:09 2011
@@ -17,62 +17,62 @@
* under the License.
*/
+package org.apache.isis.runtimes.dflt.runtime.system;
+
+import java.util.List;
-package org.apache.isis.runtimes.dflt.runtime.system;
-
-import java.util.List;
-
import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContextStatic;
import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContextThreadLocal;
import org.apache.isis.runtimes.dflt.runtime.system.session.IsisSessionFactory;
-
-/**
- * @see DeploymentType
- */
-public abstract class ContextCategory {
-
- public static ContextCategory STATIC_RELAXED = new ContextCategory(){
- @Override
- public void initContext(IsisSessionFactory sessionFactory) {
- IsisContextStatic.createRelaxedInstance(sessionFactory);
- }
- @Override
- public boolean canSpecifyViewers(List<String> viewers) {
- // no more than one
- return viewers.size() <= 1;
- }
- };
-
- public static ContextCategory STATIC = new ContextCategory() {
- @Override
- public void initContext(IsisSessionFactory sessionFactory) {
- IsisContextStatic.createInstance(sessionFactory);
- }
- @Override
- public boolean canSpecifyViewers(List<String> viewers) {
- // no more than one
- return viewers.size() == 1;
- }
- };
- public static ContextCategory THREADLOCAL = new ContextCategory() {
- @Override
- public void initContext(IsisSessionFactory sessionFactory) {
- IsisContextThreadLocal.createInstance(sessionFactory);
- }
- @Override
- public boolean canSpecifyViewers(List<String> viewers) {
- // as many as you like
- return true;
- }
- };
-
- public abstract void initContext(IsisSessionFactory sessionFactory);
-
- /**
- * Whether the list of connector names provided is compatible with this {@link ContextCategory}.
- */
- public abstract boolean canSpecifyViewers(List<String> viewers);
-
-}
-
-
+
+/**
+ * @see DeploymentType
+ */
+public abstract class ContextCategory {
+
+ public static ContextCategory STATIC_RELAXED = new ContextCategory() {
+ @Override
+ public void initContext(final IsisSessionFactory sessionFactory) {
+ IsisContextStatic.createRelaxedInstance(sessionFactory);
+ }
+
+ @Override
+ public boolean canSpecifyViewers(final List<String> viewers) {
+ // no more than one
+ return viewers.size() <= 1;
+ }
+ };
+
+ public static ContextCategory STATIC = new ContextCategory() {
+ @Override
+ public void initContext(final IsisSessionFactory sessionFactory) {
+ IsisContextStatic.createInstance(sessionFactory);
+ }
+
+ @Override
+ public boolean canSpecifyViewers(final List<String> viewers) {
+ // no more than one
+ return viewers.size() == 1;
+ }
+ };
+ public static ContextCategory THREADLOCAL = new ContextCategory() {
+ @Override
+ public void initContext(final IsisSessionFactory sessionFactory) {
+ IsisContextThreadLocal.createInstance(sessionFactory);
+ }
+
+ @Override
+ public boolean canSpecifyViewers(final List<String> viewers) {
+ // as many as you like
+ return true;
+ }
+ };
+
+ public abstract void initContext(IsisSessionFactory sessionFactory);
+
+ /**
+ * Whether the list of connector names provided is compatible with this {@link ContextCategory}.
+ */
+ public abstract boolean canSpecifyViewers(List<String> viewers);
+
+}
Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/DebugSelection.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/DebugSelection.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/DebugSelection.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/DebugSelection.java Tue May 3 06:22:09 2011
@@ -17,14 +17,13 @@
* under the License.
*/
-
package org.apache.isis.runtimes.dflt.runtime.system;
import org.apache.isis.core.commons.debug.DebuggableWithTitle;
/**
* Provides a mechanism for providing a series of DebugInfo objects, keyed on name.
- */
+ */
public interface DebugSelection {
DebuggableWithTitle debugSection(String sectionName);
Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/DeploymentCategory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/DeploymentCategory.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/DeploymentCategory.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/DeploymentCategory.java Tue May 3 06:22:09 2011
@@ -17,16 +17,11 @@
* under the License.
*/
+package org.apache.isis.runtimes.dflt.runtime.system;
-package org.apache.isis.runtimes.dflt.runtime.system;
-
-/**
- * @see DeploymentType
- */
-public enum DeploymentCategory {
- EXPLORING,
- PROTOTYPING,
- PRODUCTION;
-}
-
-
+/**
+ * @see DeploymentType
+ */
+public enum DeploymentCategory {
+ EXPLORING, PROTOTYPING, PRODUCTION;
+}
Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/DeploymentType.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/DeploymentType.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/DeploymentType.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/DeploymentType.java Tue May 3 06:22:09 2011
@@ -17,184 +17,197 @@
* under the License.
*/
+package org.apache.isis.runtimes.dflt.runtime.system;
+
+import java.util.List;
-package org.apache.isis.runtimes.dflt.runtime.system;
-
-import java.util.List;
-
import org.apache.isis.core.commons.debug.DebugBuilder;
import org.apache.isis.core.commons.debug.DebuggableWithTitle;
import org.apache.isis.runtimes.dflt.runtime.system.session.IsisSessionFactory;
-
-import com.google.common.collect.Lists;
-
-/**
- * Whether running on client or server side etc.
- *
- * <p>
- * Previously this was an <tt>enum</tt>, but it is now a regular class. The change has been made to provide
- * more flexibility in setting up the <tt>IsisContext</tt> lookup.
- *
- *
- * implementation can be created, specifying in turn a custom {@link ContextCategory} (also now a regular class) can be specified, allowing different was of setting up the
- * .
- *
- * <p>
- * To use this capability:
- * <ul>
- * <li>Write your new implementation of <tt>IsisContext</tt>, along with a static factory method (cf <tt>IsisContextStatic#createInstance(IsisSessionFactory)</tt>)
- * <li>Create a new subclass of {@link ContextCategory} (also now a regular class rather than an <tt>enum</tt>); this
- * is where your code goes to instantiate your <tt>IsisContext</tt> implementation</li>
- * <li>Create a new subclass of {@link DeploymentType}, passing in the custom {@link ContextCategory} in its constructor</li>
- * <li>In your bootstrap code, instantiate your new {@link DeploymentType} subclass</li>
- * <li>When you run your app, don't forget to specify your custom {@link DeploymentType}, eg using the <tt>--type</tt> command line arg</li>
- * </ul>
- */
-public class DeploymentType {
-
- private static List<DeploymentType> deploymentTypes = Lists.newArrayList();
-
- public static DeploymentType EXPLORATION = new DeploymentType("EXPLORATION", DeploymentCategory.EXPLORING, ContextCategory.STATIC_RELAXED, SystemConstants.VIEWER_DEFAULT, Splash.SHOW);
- public static DeploymentType PROTOTYPE = new DeploymentType("PROTOTYPE", DeploymentCategory.PROTOTYPING, ContextCategory.STATIC_RELAXED, SystemConstants.VIEWER_DEFAULT, Splash.SHOW);
- public static DeploymentType CLIENT = new DeploymentType("CLIENT", DeploymentCategory.PRODUCTION, ContextCategory.STATIC, SystemConstants.VIEWER_DEFAULT, Splash.SHOW);
- public static DeploymentType SERVER = new DeploymentType("SERVER", DeploymentCategory.PRODUCTION, ContextCategory.THREADLOCAL, null, Splash.NO_SHOW);
- public static DeploymentType SERVER_EXPLORATION = new DeploymentType("SERVER_EXPLORATION", DeploymentCategory.EXPLORING, ContextCategory.THREADLOCAL, null, Splash.NO_SHOW);
- public static DeploymentType SERVER_PROTOTYPE = new DeploymentType("SERVER_PROTOTYPE", DeploymentCategory.PROTOTYPING, ContextCategory.THREADLOCAL, null, Splash.NO_SHOW);
- public static DeploymentType SINGLE_USER = new DeploymentType("SINGLE_USER", DeploymentCategory.PRODUCTION, ContextCategory.STATIC, SystemConstants.VIEWER_DEFAULT, Splash.NO_SHOW);
- public static DeploymentType UTILITY = new DeploymentType("UTILITY", DeploymentCategory.EXPLORING, ContextCategory.STATIC, null, Splash.NO_SHOW);
-
- private final String name;
- private final DeploymentCategory deploymentCategory;
- private final ContextCategory contextCategory;
- private final String defaultViewer;
- private final Splash splash;
-
- public DeploymentType(String name, final DeploymentCategory category, ContextCategory contextCategory, final String defaultViewer, Splash splash) {
- this.deploymentCategory = category;
- this.contextCategory = contextCategory;
- this.defaultViewer = defaultViewer;
- this.splash = splash;
- this.name = name;
- deploymentTypes.add(this);
- }
-
- public DebuggableWithTitle getDebug() {
- return new DebuggableWithTitle() {
-
- public void debugData(DebugBuilder debug) {
- debug.appendln("Category", deploymentCategory);
- debug.appendln("Context", contextCategory);
- debug.appendln("Default viewer", defaultViewer == null ? "none" : defaultViewer);
- debug.appendln("Show splash", splash);
- debug.appendln();
- debug.appendln("Name", friendlyName());
- debug.appendln("Can specify object store", canSpecifyObjectStore());
- debug.appendln("Can install fixtures", canInstallFixtures());
- debug.appendln("Should monitor", shouldMonitor());
- }
-
- public String debugTitle() {
- return "Deployment type";
- }
- };
- }
-
- public void initContext(IsisSessionFactory sessionFactory) {
- contextCategory.initContext(sessionFactory);
- }
-
- /**
- * Whether the list of viewers names provided is compatible with this {@link DeploymentType}.
- *
- * @see ContextCategory#canSpecifyViewers(List)
- */
- public boolean canSpecifyViewers(List<String> viewers) {
- return contextCategory.canSpecifyViewers(viewers);
- }
-
- /**
- * Whether the list of connector names provided is compatible with this {@link DeploymentType}.
- *
- * <p>
- * Only a {@link #CLIENT} may have connectors.
- */
- public boolean canSpecifyConnectors(List<String> connectors) {
- return connectors.size() == 0 || this == CLIENT;
- }
-
- /**
- * Whether specifying an object store is compatible with this {@link DeploymentType}.
- *
- * <p>
- * Only a {@link #CLIENT} may NOT have an object store.
- */
- public boolean canSpecifyObjectStore() {
- return this != CLIENT;
- }
-
- /**
- * Whether specifying fixtures is compatible with this {@link DeploymentType}.
- *
- * <p>
- * Only a {@link #CLIENT} may NOT have an object store.
- */
- public boolean canInstallFixtures() {
- return this != CLIENT;
- }
-
- public boolean shouldShowSplash() {
- return splash.isShow();
- }
-
- public boolean shouldMonitor() {
- return (this == SERVER) && isProduction();
- }
-
- public boolean isExploring() {
- return deploymentCategory == DeploymentCategory.EXPLORING;
- }
-
- public boolean isPrototyping() {
- return deploymentCategory == DeploymentCategory.PROTOTYPING;
- }
-
- public boolean isProduction() {
- return deploymentCategory == DeploymentCategory.PRODUCTION;
- }
-
- public void addDefaultViewer(List<String> requestedViewers) {
- if (requestedViewers.size() == 0 && defaultViewer != null) {
- requestedViewers.add(defaultViewer);
- }
- }
-
- /**
- * Look up {@link DeploymentType} by their {@link #name()}.
- *
- * <p>
- * Can substitute <tt>'-'</tt> instead of <tt>'_'</tt>; for example <tt>server_exploration</tt>
- * will lookup the same as <tt>server-exploration</tt>.
- */
- public static DeploymentType lookup(final String str) {
- String underscoredStr = str.replace('-', '_').toUpperCase();
- for (DeploymentType deploymentType : deploymentTypes) {
- if (underscoredStr.equals(deploymentType.name())) {
- return deploymentType;
- }
- }
- throw new IllegalArgumentException(String.format("Unknown deployment type '%s'", str));
- }
-
- public String friendlyName() {
- return nameLowerCase().replace('_', '-');
- }
-
- public String nameLowerCase() {
- return name().toLowerCase();
- }
-
- public String name() {
- return name;
- }
-
+
+import com.google.common.collect.Lists;
+
+/**
+ * Whether running on client or server side etc.
+ *
+ * <p>
+ * Previously this was an <tt>enum</tt>, but it is now a regular class. The change has been made to provide more
+ * flexibility in setting up the <tt>IsisContext</tt> lookup.
+ *
+ *
+ * implementation can be created, specifying in turn a custom {@link ContextCategory} (also now a regular class) can be
+ * specified, allowing different was of setting up the .
+ *
+ * <p>
+ * To use this capability:
+ * <ul>
+ * <li>Write your new implementation of <tt>IsisContext</tt>, along with a static factory method (cf
+ * <tt>IsisContextStatic#createInstance(IsisSessionFactory)</tt>)
+ * <li>Create a new subclass of {@link ContextCategory} (also now a regular class rather than an <tt>enum</tt>); this is
+ * where your code goes to instantiate your <tt>IsisContext</tt> implementation</li>
+ * <li>Create a new subclass of {@link DeploymentType}, passing in the custom {@link ContextCategory} in its constructor
+ * </li>
+ * <li>In your bootstrap code, instantiate your new {@link DeploymentType} subclass</li>
+ * <li>When you run your app, don't forget to specify your custom {@link DeploymentType}, eg using the <tt>--type</tt>
+ * command line arg</li>
+ * </ul>
+ */
+public class DeploymentType {
+
+ private static List<DeploymentType> deploymentTypes = Lists.newArrayList();
+
+ public static DeploymentType EXPLORATION = new DeploymentType("EXPLORATION", DeploymentCategory.EXPLORING,
+ ContextCategory.STATIC_RELAXED, SystemConstants.VIEWER_DEFAULT, Splash.SHOW);
+ public static DeploymentType PROTOTYPE = new DeploymentType("PROTOTYPE", DeploymentCategory.PROTOTYPING,
+ ContextCategory.STATIC_RELAXED, SystemConstants.VIEWER_DEFAULT, Splash.SHOW);
+ public static DeploymentType CLIENT = new DeploymentType("CLIENT", DeploymentCategory.PRODUCTION,
+ ContextCategory.STATIC, SystemConstants.VIEWER_DEFAULT, Splash.SHOW);
+ public static DeploymentType SERVER = new DeploymentType("SERVER", DeploymentCategory.PRODUCTION,
+ ContextCategory.THREADLOCAL, null, Splash.NO_SHOW);
+ public static DeploymentType SERVER_EXPLORATION = new DeploymentType("SERVER_EXPLORATION",
+ DeploymentCategory.EXPLORING, ContextCategory.THREADLOCAL, null, Splash.NO_SHOW);
+ public static DeploymentType SERVER_PROTOTYPE = new DeploymentType("SERVER_PROTOTYPE",
+ DeploymentCategory.PROTOTYPING, ContextCategory.THREADLOCAL, null, Splash.NO_SHOW);
+ public static DeploymentType SINGLE_USER = new DeploymentType("SINGLE_USER", DeploymentCategory.PRODUCTION,
+ ContextCategory.STATIC, SystemConstants.VIEWER_DEFAULT, Splash.NO_SHOW);
+ public static DeploymentType UTILITY = new DeploymentType("UTILITY", DeploymentCategory.EXPLORING,
+ ContextCategory.STATIC, null, Splash.NO_SHOW);
+
+ private final String name;
+ private final DeploymentCategory deploymentCategory;
+ private final ContextCategory contextCategory;
+ private final String defaultViewer;
+ private final Splash splash;
+
+ public DeploymentType(final String name, final DeploymentCategory category, final ContextCategory contextCategory,
+ final String defaultViewer, final Splash splash) {
+ this.deploymentCategory = category;
+ this.contextCategory = contextCategory;
+ this.defaultViewer = defaultViewer;
+ this.splash = splash;
+ this.name = name;
+ deploymentTypes.add(this);
+ }
+
+ public DebuggableWithTitle getDebug() {
+ return new DebuggableWithTitle() {
+
+ @Override
+ public void debugData(final DebugBuilder debug) {
+ debug.appendln("Category", deploymentCategory);
+ debug.appendln("Context", contextCategory);
+ debug.appendln("Default viewer", defaultViewer == null ? "none" : defaultViewer);
+ debug.appendln("Show splash", splash);
+ debug.appendln();
+ debug.appendln("Name", friendlyName());
+ debug.appendln("Can specify object store", canSpecifyObjectStore());
+ debug.appendln("Can install fixtures", canInstallFixtures());
+ debug.appendln("Should monitor", shouldMonitor());
+ }
+
+ @Override
+ public String debugTitle() {
+ return "Deployment type";
+ }
+ };
+ }
+
+ public void initContext(final IsisSessionFactory sessionFactory) {
+ contextCategory.initContext(sessionFactory);
+ }
+
+ /**
+ * Whether the list of viewers names provided is compatible with this {@link DeploymentType}.
+ *
+ * @see ContextCategory#canSpecifyViewers(List)
+ */
+ public boolean canSpecifyViewers(final List<String> viewers) {
+ return contextCategory.canSpecifyViewers(viewers);
+ }
+
+ /**
+ * Whether the list of connector names provided is compatible with this {@link DeploymentType}.
+ *
+ * <p>
+ * Only a {@link #CLIENT} may have connectors.
+ */
+ public boolean canSpecifyConnectors(final List<String> connectors) {
+ return connectors.size() == 0 || this == CLIENT;
+ }
+
+ /**
+ * Whether specifying an object store is compatible with this {@link DeploymentType}.
+ *
+ * <p>
+ * Only a {@link #CLIENT} may NOT have an object store.
+ */
+ public boolean canSpecifyObjectStore() {
+ return this != CLIENT;
+ }
+
+ /**
+ * Whether specifying fixtures is compatible with this {@link DeploymentType}.
+ *
+ * <p>
+ * Only a {@link #CLIENT} may NOT have an object store.
+ */
+ public boolean canInstallFixtures() {
+ return this != CLIENT;
+ }
+
+ public boolean shouldShowSplash() {
+ return splash.isShow();
+ }
+
+ public boolean shouldMonitor() {
+ return (this == SERVER) && isProduction();
+ }
+
+ public boolean isExploring() {
+ return deploymentCategory == DeploymentCategory.EXPLORING;
+ }
+
+ public boolean isPrototyping() {
+ return deploymentCategory == DeploymentCategory.PROTOTYPING;
+ }
+
+ public boolean isProduction() {
+ return deploymentCategory == DeploymentCategory.PRODUCTION;
+ }
+
+ public void addDefaultViewer(final List<String> requestedViewers) {
+ if (requestedViewers.size() == 0 && defaultViewer != null) {
+ requestedViewers.add(defaultViewer);
+ }
+ }
+
+ /**
+ * Look up {@link DeploymentType} by their {@link #name()}.
+ *
+ * <p>
+ * Can substitute <tt>'-'</tt> instead of <tt>'_'</tt>; for example <tt>server_exploration</tt> will lookup the same
+ * as <tt>server-exploration</tt>.
+ */
+ public static DeploymentType lookup(final String str) {
+ final String underscoredStr = str.replace('-', '_').toUpperCase();
+ for (final DeploymentType deploymentType : deploymentTypes) {
+ if (underscoredStr.equals(deploymentType.name())) {
+ return deploymentType;
+ }
+ }
+ throw new IllegalArgumentException(String.format("Unknown deployment type '%s'", str));
+ }
+
+ public String friendlyName() {
+ return nameLowerCase().replace('_', '-');
+ }
+
+ public String nameLowerCase() {
+ return name().toLowerCase();
+ }
+
+ public String name() {
+ return name;
+ }
+
}
\ No newline at end of file
Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/IsisSystem.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/IsisSystem.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/IsisSystem.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/IsisSystem.java Tue May 3 06:22:09 2011
@@ -17,31 +17,28 @@
* under the License.
*/
+package org.apache.isis.runtimes.dflt.runtime.system;
-package org.apache.isis.runtimes.dflt.runtime.system;
-
-import org.apache.isis.applib.fixtures.LogonFixture;
+import org.apache.isis.applib.fixtures.LogonFixture;
import org.apache.isis.core.commons.components.ApplicationScopedComponent;
import org.apache.isis.core.commons.config.IsisConfiguration;
import org.apache.isis.runtimes.dflt.runtime.system.session.IsisSessionFactory;
-
-public interface IsisSystem extends DebugSelection, ApplicationScopedComponent {
-
- DeploymentType getDeploymentType();
-
- LogonFixture getLogonFixture();
-
- /**
- * Populated after {@link #init()}.
- */
- public IsisSessionFactory getSessionFactory();
-
- /**
- * Returns a <i>snapshot</i> of the {@link IsisConfiguration configuration} (although
- * once the {@link IsisSystem} is completely initialized, will effectively be immutable).
- */
- IsisConfiguration getConfiguration();
-
-}
-
-
+
+public interface IsisSystem extends DebugSelection, ApplicationScopedComponent {
+
+ DeploymentType getDeploymentType();
+
+ LogonFixture getLogonFixture();
+
+ /**
+ * Populated after {@link #init()}.
+ */
+ public IsisSessionFactory getSessionFactory();
+
+ /**
+ * Returns a <i>snapshot</i> of the {@link IsisConfiguration configuration} (although once the {@link IsisSystem} is
+ * completely initialized, will effectively be immutable).
+ */
+ IsisConfiguration getConfiguration();
+
+}
Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/IsisSystemException.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/IsisSystemException.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/IsisSystemException.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/IsisSystemException.java Tue May 3 06:22:09 2011
@@ -17,27 +17,25 @@
* under the License.
*/
+package org.apache.isis.runtimes.dflt.runtime.system;
-package org.apache.isis.runtimes.dflt.runtime.system;
-
-public class IsisSystemException extends Exception {
-
- private static final long serialVersionUID = 1L;
-
- public IsisSystemException() {}
-
- public IsisSystemException(String message) {
- super(message);
- }
-
- public IsisSystemException(Throwable cause) {
- super(cause);
- }
-
- public IsisSystemException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
-
-
+public class IsisSystemException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ public IsisSystemException() {
+ }
+
+ public IsisSystemException(final String message) {
+ super(message);
+ }
+
+ public IsisSystemException(final Throwable cause) {
+ super(cause);
+ }
+
+ public IsisSystemException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+
+}
Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/IsisSystemFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/IsisSystemFactory.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/IsisSystemFactory.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/IsisSystemFactory.java Tue May 3 06:22:09 2011
@@ -17,17 +17,15 @@
* under the License.
*/
+package org.apache.isis.runtimes.dflt.runtime.system;
-package org.apache.isis.runtimes.dflt.runtime.system;
-
import org.apache.isis.core.commons.components.ApplicationScopedComponent;
-
-/**
- * Pluggable mechanism for creating {@link IsisSystem}s.
- */
-public interface IsisSystemFactory extends ApplicationScopedComponent {
-
- IsisSystem createSystem(
- final DeploymentType deploymentType);
-
-}
+
+/**
+ * Pluggable mechanism for creating {@link IsisSystem}s.
+ */
+public interface IsisSystemFactory extends ApplicationScopedComponent {
+
+ IsisSystem createSystem(final DeploymentType deploymentType);
+
+}
Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/IsisSystemFixturesHookAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/IsisSystemFixturesHookAbstract.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/IsisSystemFixturesHookAbstract.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/IsisSystemFixturesHookAbstract.java Tue May 3 06:22:09 2011
@@ -22,11 +22,7 @@ package org.apache.isis.runtimes.dflt.ru
import java.io.File;
import java.util.List;
-import org.apache.log4j.Logger;
-
import org.apache.isis.applib.fixtures.LogonFixture;
-import org.apache.isis.core.commons.components.Installer;
-import org.apache.isis.core.commons.components.Noop;
import org.apache.isis.core.commons.config.IsisConfiguration;
import org.apache.isis.core.commons.debug.DebugBuilder;
import org.apache.isis.core.commons.debug.DebuggableWithTitle;
@@ -37,20 +33,18 @@ import org.apache.isis.core.runtime.imag
import org.apache.isis.core.runtime.imageloader.awt.TemplateImageLoaderAwt;
import org.apache.isis.core.runtime.userprofile.UserProfileStore;
import org.apache.isis.runtimes.dflt.runtime.authentication.exploration.ExplorationSession;
-import org.apache.isis.runtimes.dflt.runtime.fixtures.FixturesInstaller;
import org.apache.isis.runtimes.dflt.runtime.installerregistry.InstallerLookup;
import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
-import org.apache.isis.runtimes.dflt.runtime.system.internal.InitialisationSession;
import org.apache.isis.runtimes.dflt.runtime.system.internal.IsisLocaleInitializer;
import org.apache.isis.runtimes.dflt.runtime.system.internal.IsisTimeZoneInitializer;
import org.apache.isis.runtimes.dflt.runtime.system.internal.SplashWindow;
import org.apache.isis.runtimes.dflt.runtime.system.persistence.PersistenceSessionFactory;
import org.apache.isis.runtimes.dflt.runtime.system.session.IsisSession;
import org.apache.isis.runtimes.dflt.runtime.system.session.IsisSessionFactory;
+import org.apache.log4j.Logger;
-/**
- * An implementation of {@link IsisSystem} that has a hook for installing
- * fixtures but does not install them itself.
+/**
+ * An implementation of {@link IsisSystem} that has a hook for installing fixtures but does not install them itself.
*/
public abstract class IsisSystemFixturesHookAbstract implements IsisSystem {
@@ -76,8 +70,8 @@ public abstract class IsisSystemFixtures
this(deploymentType, new IsisLocaleInitializer(), new IsisTimeZoneInitializer());
}
- public IsisSystemFixturesHookAbstract(final DeploymentType deploymentType, final IsisLocaleInitializer localeInitializer,
- final IsisTimeZoneInitializer timeZoneInitializer) {
+ public IsisSystemFixturesHookAbstract(final DeploymentType deploymentType,
+ final IsisLocaleInitializer localeInitializer, final IsisTimeZoneInitializer timeZoneInitializer) {
this.deploymentType = deploymentType;
this.localeInitializer = localeInitializer;
this.timeZoneInitializer = timeZoneInitializer;
@@ -114,23 +108,22 @@ public abstract class IsisSystemFixtures
int splashDelay = SPLASH_DELAY_DEFAULT;
try {
- TemplateImageLoader splashLoader = obtainTemplateImageLoader();
+ final TemplateImageLoader splashLoader = obtainTemplateImageLoader();
splashLoader.init();
showSplash(splashLoader);
sessionFactory = doCreateSessionFactory(deploymentType);
-
+
// temporarily make a configuration available
// REVIEW: would rather inject this, or perhaps even the ConfigurationBuilder
IsisContext.setConfiguration(getConfiguration());
-
initContext(sessionFactory);
sessionFactory.init();
installFixturesIfRequired();
- } catch (IsisSystemException ex) {
+ } catch (final IsisSystemException ex) {
LOG.error("failed to initialise", ex);
splashDelay = 0;
throw new RuntimeException(ex);
@@ -139,8 +132,7 @@ public abstract class IsisSystemFixtures
}
}
-
- private void initContext(IsisSessionFactory sessionFactory) {
+ private void initContext(final IsisSessionFactory sessionFactory) {
getDeploymentType().initContext(sessionFactory);
}
@@ -212,15 +204,12 @@ public abstract class IsisSystemFixtures
// Fixtures (hooks)
// ///////////////////////////////////////////
-
/**
- * Optional hook for appending debug information pertaining to
- * fixtures installer if required.
+ * Optional hook for appending debug information pertaining to fixtures installer if required.
*/
- protected void appendFixturesInstallerDebug(DebugBuilder debug) {
+ protected void appendFixturesInstallerDebug(final DebugBuilder debug) {
}
-
/**
* The {@link LogonFixture}, if any, obtained by running fixtures.
*
@@ -246,7 +235,6 @@ public abstract class IsisSystemFixtures
protected void installFixturesIfRequired() throws IsisSystemException {
}
-
// ///////////////////////////////////////////
// Authentication Manager
// ///////////////////////////////////////////
@@ -266,15 +254,13 @@ public abstract class IsisSystemFixtures
protected abstract List<Object> obtainServices();
-
-
// ///////////////////////////////////////////
// Splash
// ///////////////////////////////////////////
- private void showSplash(TemplateImageLoader imageLoader) {
+ private void showSplash(final TemplateImageLoader imageLoader) {
- boolean vetoSplashFromConfig =
+ final boolean vetoSplashFromConfig =
getConfiguration().getBoolean(SystemConstants.NOSPLASH_KEY, SystemConstants.NOSPLASH_DEFAULT);
if (!vetoSplashFromConfig && getDeploymentType().shouldShowSplash()) {
splashWindow = new SplashWindow(imageLoader);
@@ -308,7 +294,7 @@ public abstract class IsisSystemFixtures
}
@Override
- public DebuggableWithTitle debugSection(String selectionName) {
+ public DebuggableWithTitle debugSection(final String selectionName) {
// DebugInfo deb;
if (selectionName.equals("Configuration")) {
return getConfiguration();
@@ -333,10 +319,10 @@ public abstract class IsisSystemFixtures
private void debugListContexts(final DebugBuilder debug) {
final String[] contextIds = IsisContext.getInstance().allSessionIds();
- for (int i = 0; i < contextIds.length; i++) {
- debug.appendln(contextIds[i]);
+ for (final String contextId : contextIds) {
+ debug.appendln(contextId);
debug.appendln("-----");
- final IsisSession d = IsisContext.getSession(contextIds[i]);
+ final IsisSession d = IsisContext.getSession(contextId);
d.debug(debug);
debug.appendln();
}
@@ -382,15 +368,14 @@ public abstract class IsisSystemFixtures
debug.appendln("Configuration", getConfiguration().getClass().getName());
final DebuggableWithTitle[] inf = IsisContext.debugSystem();
- for (int i = 0; i < inf.length; i++) {
- if (inf[i] != null) {
- inf[i].debugData(debug);
+ for (final DebuggableWithTitle element : inf) {
+ if (element != null) {
+ element.debugData(debug);
}
}
- } catch (RuntimeException e) {
+ } catch (final RuntimeException e) {
debug.appendException(e);
}
}
-
}