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 2016/05/10 07:35:47 UTC
isis git commit: ISIS-1370: now supports publishing of objects.
Repository: isis
Updated Branches:
refs/heads/ISIS-1291 7dab5d61b -> b01781b05
ISIS-1370: now supports publishing of objects.
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/b01781b0
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/b01781b0
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/b01781b0
Branch: refs/heads/ISIS-1291
Commit: b01781b0507e5f49a770f8079b4d477a156201fa
Parents: 7dab5d6
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Tue May 10 08:35:35 2016 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Tue May 10 08:35:35 2016 +0100
----------------------------------------------------------------------
.../services/publish/PublisherService.java | 5 +-
.../publish/PublisherServiceLogging.java | 35 +++++
.../isis/schema/utils/ChangesDtoUtils.java | 146 +++++++++++++++++++
.../schema/utils/MemberExecutionDtoUtils.java | 12 +-
...gExAnnotationOnPropertyFacetFactoryTest.java | 4 +-
.../PublishingServiceInternalDefault.java | 98 +++++++++----
.../transaction/IsisTransactionManager.java | 6 +-
core/schema/pom.xml | 17 ++-
.../org/apache/isis/schema/bindings.xml | 79 ++++++++++
.../org/apache/isis/schema/chg/chg-1.0.xsd | 82 +++++++++++
.../apache/isis/schema/cmd/cmd-1.0-binding.xml | 53 -------
.../apache/isis/schema/common/common-1.0.xsd | 1 -
.../apache/isis/schema/ixn/ixn-1.0-binding.xml | 66 ---------
.../org/apache/isis/schema/ixn/ixn-1.0.xsd | 2 +-
.../java/domainapp/dom/simple/SimpleObject.java | 5 +-
.../src/main/webapp/WEB-INF/logging.properties | 14 +-
16 files changed, 452 insertions(+), 173 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/b01781b0/core/applib/src/main/java/org/apache/isis/applib/services/publish/PublisherService.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/publish/PublisherService.java b/core/applib/src/main/java/org/apache/isis/applib/services/publish/PublisherService.java
index 934aa69..2ea2a90 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/services/publish/PublisherService.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/publish/PublisherService.java
@@ -18,7 +18,10 @@
*/
package org.apache.isis.applib.services.publish;
+import java.util.List;
+
import org.apache.isis.applib.annotation.Programmatic;
+import org.apache.isis.applib.services.bookmark.Bookmark;
import org.apache.isis.applib.services.iactn.Interaction;
/**
@@ -38,7 +41,7 @@ public interface PublisherService {
@Programmatic
void publish(final Interaction.Execution<?, ?> execution);
-
+ void publish(final List<Bookmark> created, final List<Bookmark> updated, final List<Bookmark> deleted);
}
http://git-wip-us.apache.org/repos/asf/isis/blob/b01781b0/core/applib/src/main/java/org/apache/isis/applib/services/publish/PublisherServiceLogging.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/publish/PublisherServiceLogging.java b/core/applib/src/main/java/org/apache/isis/applib/services/publish/PublisherServiceLogging.java
index 4bcf958..9d6fe64 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/services/publish/PublisherServiceLogging.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/publish/PublisherServiceLogging.java
@@ -18,15 +18,24 @@
*/
package org.apache.isis.applib.services.publish;
+import java.util.List;
+
import javax.annotation.PostConstruct;
+import javax.inject.Inject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.isis.applib.annotation.DomainService;
import org.apache.isis.applib.annotation.NatureOfService;
+import org.apache.isis.applib.services.bookmark.Bookmark;
+import org.apache.isis.applib.services.command.Command;
+import org.apache.isis.applib.services.command.CommandContext;
import org.apache.isis.applib.services.iactn.Interaction;
+import org.apache.isis.applib.services.user.UserService;
+import org.apache.isis.schema.chg.v1.ChangesDto;
import org.apache.isis.schema.ixn.v1.InteractionDto;
+import org.apache.isis.schema.utils.ChangesDtoUtils;
import org.apache.isis.schema.utils.InteractionDtoUtils;
@DomainService(nature = NatureOfService.DOMAIN)
@@ -53,5 +62,31 @@ public class PublisherServiceLogging implements PublisherService {
}
+ @Override
+ public void publish(
+ final List<Bookmark> created,
+ final List<Bookmark> updated,
+ final List<Bookmark> deleted) {
+
+ if(!LOG.isDebugEnabled()) {
+ return;
+ }
+
+ final Command command = commandContext.getCommand();
+ final String transactionId = command.getTransactionId().toString();
+ final String userName = userService.getUser().getName();
+
+ final ChangesDto changesDto = ChangesDtoUtils.newChangesDto(transactionId, userName, created, updated, deleted);
+
+ LOG.debug(ChangesDtoUtils.toXml(changesDto));
+ }
+
+
+ @Inject
+ private CommandContext commandContext;
+
+ @Inject
+ private UserService userService;
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/b01781b0/core/applib/src/main/java/org/apache/isis/schema/utils/ChangesDtoUtils.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/schema/utils/ChangesDtoUtils.java b/core/applib/src/main/java/org/apache/isis/schema/utils/ChangesDtoUtils.java
new file mode 100644
index 0000000..6d2100b
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/schema/utils/ChangesDtoUtils.java
@@ -0,0 +1,146 @@
+/*
+ * 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.schema.utils;
+
+import java.io.CharArrayWriter;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.Writer;
+import java.net.URL;
+import java.nio.charset.Charset;
+import java.util.Collection;
+import java.util.List;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+
+import com.google.common.collect.Lists;
+import com.google.common.io.Resources;
+
+import org.apache.isis.applib.services.bookmark.Bookmark;
+import org.apache.isis.schema.chg.v1.ChangesDto;
+import org.apache.isis.schema.common.v1.OidDto;
+import org.apache.isis.schema.common.v1.OidsDto;
+
+public final class ChangesDtoUtils {
+
+ //region > marshalling
+ static JAXBContext jaxbContext;
+ static JAXBContext getJaxbContext() {
+ if(jaxbContext == null) {
+ try {
+ jaxbContext = JAXBContext.newInstance(ChangesDto.class);
+ } catch (JAXBException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ return jaxbContext;
+ }
+
+ public static ChangesDto fromXml(final Reader reader) {
+ try {
+ final Unmarshaller un = getJaxbContext().createUnmarshaller();
+ return (ChangesDto) un.unmarshal(reader);
+ } catch (JAXBException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static ChangesDto fromXml(final String xml) {
+ return fromXml(new StringReader(xml));
+ }
+
+ public static ChangesDto fromXml(
+ final Class<?> contextClass,
+ final String resourceName,
+ final Charset charset) throws IOException {
+ final URL url = Resources.getResource(contextClass, resourceName);
+ final String s = Resources.toString(url, charset);
+ return fromXml(new StringReader(s));
+ }
+
+ public static String toXml(final ChangesDto changesDto) {
+ final CharArrayWriter caw = new CharArrayWriter();
+ toXml(changesDto, caw);
+ return caw.toString();
+ }
+
+ public static void toXml(final ChangesDto changesDto, final Writer writer) {
+ try {
+ final Marshaller m = getJaxbContext().createMarshaller();
+ m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
+ m.marshal(changesDto, writer);
+ } catch (JAXBException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ //endregion
+
+ //region > newChangesDto
+
+ public static ChangesDto newChangesDto(
+ final String transactionId,
+ final String userName,
+ final List<Bookmark> created,
+ final List<Bookmark> updated, final List<Bookmark> deleted) {
+
+ final ChangesDto changesDto = new ChangesDto();
+
+ changesDto.setMajorVersion("1");
+ changesDto.setMinorVersion("0");
+
+ changesDto.setTransactionId(transactionId);
+
+ changesDto.setCreated(new OidsDto());
+ changesDto.setUpdated(new OidsDto());
+ changesDto.setDeleted(new OidsDto());
+
+ changesDto.setTransactionId(transactionId);
+ changesDto.setUser(userName);
+
+ changesDto.getCreated().getOid().addAll(asList(created));
+ changesDto.getUpdated().getOid().addAll(asList(updated));
+ changesDto.getDeleted().getOid().addAll(asList(deleted));
+
+ return changesDto;
+ }
+
+ private static Collection<OidDto> asList(final List<Bookmark> bookmarks) {
+ final List<OidDto> oids = Lists.newArrayList();
+ for (Bookmark bookmark : bookmarks) {
+ oids.add(bookmark.toOidDto());
+ }
+ return oids;
+ }
+
+ //endregion
+
+
+ //region > debugging (dump)
+ public static void dump(final ChangesDto changesDto, final PrintStream out) throws JAXBException {
+ out.println(toXml(changesDto));
+ }
+
+ //endregion
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/b01781b0/core/applib/src/main/java/org/apache/isis/schema/utils/MemberExecutionDtoUtils.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/schema/utils/MemberExecutionDtoUtils.java b/core/applib/src/main/java/org/apache/isis/schema/utils/MemberExecutionDtoUtils.java
index 844d468..f1309f5 100644
--- a/core/applib/src/main/java/org/apache/isis/schema/utils/MemberExecutionDtoUtils.java
+++ b/core/applib/src/main/java/org/apache/isis/schema/utils/MemberExecutionDtoUtils.java
@@ -95,26 +95,26 @@ public final class MemberExecutionDtoUtils {
}
public static DifferenceDto numberObjectsLoadedFor(final ObjectCountsDto objectCountsDto) {
- DifferenceDto differenceDto = objectCountsDto.getNumberObjectsLoaded();
+ DifferenceDto differenceDto = objectCountsDto.getLoaded();
if(differenceDto == null) {
differenceDto = new DifferenceDto();
- objectCountsDto.setNumberObjectsLoaded(differenceDto);
+ objectCountsDto.setLoaded(differenceDto);
}
return differenceDto;
}
public static DifferenceDto numberObjectsDirtiedFor(final ObjectCountsDto objectCountsDto) {
- DifferenceDto differenceDto = objectCountsDto.getNumberObjectsDirtied();
+ DifferenceDto differenceDto = objectCountsDto.getDirtied();
if(differenceDto == null) {
differenceDto = new DifferenceDto();
- objectCountsDto.setNumberObjectsDirtied(differenceDto);
+ objectCountsDto.setDirtied(differenceDto);
}
return differenceDto;
}
public static DifferenceDto numberObjectPropertiesModifiedFor(final ObjectCountsDto objectCountsDto) {
- DifferenceDto differenceDto = objectCountsDto.getNumberObjectPropertiesModified();
+ DifferenceDto differenceDto = objectCountsDto.getPropertiesModified();
if(differenceDto == null) {
differenceDto = new DifferenceDto();
- objectCountsDto.setNumberObjectPropertiesModified(differenceDto);
+ objectCountsDto.setPropertiesModified(differenceDto);
}
return differenceDto;
}
http://git-wip-us.apache.org/repos/asf/isis/blob/b01781b0/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/properties/property/RegExAnnotationOnPropertyFacetFactoryTest.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/properties/property/RegExAnnotationOnPropertyFacetFactoryTest.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/properties/property/RegExAnnotationOnPropertyFacetFactoryTest.java
index 36ab4a3..7c85514 100644
--- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/properties/property/RegExAnnotationOnPropertyFacetFactoryTest.java
+++ b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/properties/property/RegExAnnotationOnPropertyFacetFactoryTest.java
@@ -49,7 +49,7 @@ public class RegExAnnotationOnPropertyFacetFactoryTest extends AbstractFacetFact
}
final Method method = findMethod(Customer.class, "getFirstName");
- facetFactory.process(new ProcessMethodContext(Customer.class, null, null, method, methodRemover, facetedMethod));
+ facetFactory.processRegEx(new ProcessMethodContext(Customer.class, null, null, method, methodRemover, facetedMethod));
final Facet facet = facetedMethod.getFacet(RegExFacet.class);
assertNotNull(facet);
@@ -70,7 +70,7 @@ public class RegExAnnotationOnPropertyFacetFactoryTest extends AbstractFacetFact
}
final Method method = findMethod(Customer.class, "getNumberOfOrders");
- facetFactory.process(new ProcessMethodContext(Customer.class, null, null, method, methodRemover, facetedMethod));
+ facetFactory.processRegEx(new ProcessMethodContext(Customer.class, null, null, method, methodRemover, facetedMethod));
assertNull(facetedMethod.getFacet(RegExFacet.class));
}
http://git-wip-us.apache.org/repos/asf/isis/blob/b01781b0/core/runtime/src/main/java/org/apache/isis/core/runtime/services/publishing/PublishingServiceInternalDefault.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/publishing/PublishingServiceInternalDefault.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/publishing/PublishingServiceInternalDefault.java
index 4d9295f..7af1598 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/publishing/PublishingServiceInternalDefault.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/publishing/PublishingServiceInternalDefault.java
@@ -30,6 +30,7 @@ import javax.inject.Inject;
import com.google.common.base.Function;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
import org.apache.isis.applib.Identifier;
import org.apache.isis.applib.annotation.DomainService;
@@ -113,30 +114,36 @@ public class PublishingServiceInternalDefault implements PublishingServiceIntern
@Override
@Programmatic
public void publishObjects() {
- publishObjectsToPublishingService();
+
+ // take a copy of enlisted adapters ... the JDO implementation of the PublishingService
+ // creates further entities which would be enlisted; taking copy of the map avoids ConcurrentModificationException
+ final Map<ObjectAdapter, ChangeKind> changeKindByEnlistedAdapter = Maps.newHashMap();
+ changeKindByEnlistedAdapter.putAll(enlistedObjectsServiceInternal.getChangeKindByEnlistedAdapter());
+
+ publishObjectsToPublishingService(changeKindByEnlistedAdapter);
+ publishObjectsToPublisherServices(changeKindByEnlistedAdapter);
}
- private void publishObjectsToPublishingService() {
- final Map<ObjectAdapter, ChangeKind> changeKindByEnlistedAdapter =
- enlistedObjectsServiceInternal.getChangeKindByEnlistedAdapter();
+ private void publishObjectsToPublishingService(final Map<ObjectAdapter, ChangeKind> changeKindByEnlistedAdapter) {
+
+ if(publishingServiceIfAny == null) {
+ return;
+ }
final String currentUser = userService.getUser().getName();
final Timestamp timestamp = clockService.nowAsJavaSqlTimestamp();
final ObjectStringifier stringifier = objectStringifier();
- // take a copy of enlisted adapters ... the JDO implementation of the PublishingService
- // creates further entities which would be enlisted; taking copy of the keys avoids ConcurrentModificationException
- final List<ObjectAdapter> enlistedAdapters =
- Lists.newArrayList(changeKindByEnlistedAdapter.keySet());
-
- for (final ObjectAdapter enlistedAdapter : enlistedAdapters) {
- final ChangeKind changeKind = changeKindByEnlistedAdapter.get(enlistedAdapter);
+ for (final Map.Entry<ObjectAdapter, ChangeKind> adapterAndChange : changeKindByEnlistedAdapter.entrySet()) {
+ final ObjectAdapter enlistedAdapter = adapterAndChange.getKey();
+ final ChangeKind changeKind = adapterAndChange.getValue();
- publishObject(enlistedAdapter, changeKind, currentUser, timestamp, stringifier);
+ publishObjectToPublishingService(
+ enlistedAdapter, changeKind, currentUser, timestamp, stringifier);
}
}
- private void publishObject(
+ private void publishObjectToPublishingService(
final ObjectAdapter enlistedAdapter,
final ChangeKind changeKind,
final String currentUser,
@@ -149,24 +156,6 @@ public class PublishingServiceInternalDefault implements PublishingServiceIntern
return;
}
- publishObjectToPublishingService(
- enlistedAdapter, changeKind, currentUser, timestamp, stringifier);
- }
-
- private void publishObjectToPublishingService(
- final ObjectAdapter enlistedAdapter,
- final ChangeKind changeKind,
- final String currentUser,
- final Timestamp timestamp,
- final ObjectStringifier stringifier) {
-
- if(publishingServiceIfAny == null) {
- return;
- }
-
- final PublishedObjectFacet publishedObjectFacet =
- enlistedAdapter.getSpecification().getFacet(PublishedObjectFacet.class);
-
final PublishedObject.PayloadFactory payloadFactory = publishedObjectFacet.value();
final RootOid enlistedAdapterOid = (RootOid) enlistedAdapter.getOid();
@@ -183,6 +172,53 @@ public class PublishingServiceInternalDefault implements PublishingServiceIntern
publishingServiceIfAny.publish(metadata, payload);
}
+ private void publishObjectsToPublisherServices(final Map<ObjectAdapter, ChangeKind> changeKindByEnlistedAdapter) {
+
+ final List<Bookmark> created = Lists.newArrayList();
+ final List<Bookmark> updated = Lists.newArrayList();
+ final List<Bookmark> deleted = Lists.newArrayList();
+
+ for (final Map.Entry<ObjectAdapter, ChangeKind> adapterAndChange : changeKindByEnlistedAdapter.entrySet()) {
+ final ObjectAdapter enlistedAdapter = adapterAndChange.getKey();
+
+ final PublishedObjectFacet publishedObjectFacet =
+ enlistedAdapter.getSpecification().getFacet(PublishedObjectFacet.class);
+
+ if(publishedObjectFacet == null) {
+ continue;
+ }
+
+ final ChangeKind changeKind = adapterAndChange.getValue();
+
+ final RootOid rootOid = (RootOid) enlistedAdapter.getOid();
+ final Bookmark bookmark = rootOid.asBookmark();
+
+ switch (changeKind) {
+ case CREATE:
+ created.add(bookmark);
+ break;
+ case UPDATE:
+ updated.add(bookmark);
+ break;
+ case DELETE:
+ deleted.add(bookmark);
+ break;
+ default:
+ // shouldn't happen
+ throw new RuntimeException("ChangeKind '" + changeKind + "' not recognized");
+ }
+ }
+
+ if(created.isEmpty() && updated.isEmpty() && deleted.isEmpty()) {
+ return;
+ }
+
+ for (PublisherService publisherService : publisherServices) {
+ publisherService.publish(created, updated, deleted);
+ }
+ }
+
+
@Programmatic
public void publishAction(
final Interaction.Execution execution,
http://git-wip-us.apache.org/repos/asf/isis/blob/b01781b0/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionManager.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionManager.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionManager.java
index 18be7e1..402d0a7 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionManager.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionManager.java
@@ -34,6 +34,7 @@ import org.apache.isis.applib.services.command.spi.CommandService;
import org.apache.isis.applib.services.factory.FactoryService;
import org.apache.isis.applib.services.iactn.Interaction;
import org.apache.isis.applib.services.iactn.InteractionContext;
+import org.apache.isis.applib.services.user.UserService;
import org.apache.isis.core.commons.authentication.AuthenticationSession;
import org.apache.isis.core.commons.authentication.MessageBroker;
import org.apache.isis.core.commons.components.SessionScopedComponent;
@@ -76,6 +77,7 @@ public class IsisTransactionManager implements SessionScopedComponent {
private final InteractionContext interactionContext;
private final ClockService clockService;
+ private final UserService userService;
// ////////////////////////////////////////////////////////////////
@@ -110,6 +112,7 @@ public class IsisTransactionManager implements SessionScopedComponent {
this.interactionContext = lookupService(InteractionContext.class);
this.clockService = lookupService(ClockService.class);
+ this.userService = lookupService(UserService.class);
}
public PersistenceSessionTransactionManagement getPersistenceSession() {
@@ -382,14 +385,13 @@ public class IsisTransactionManager implements SessionScopedComponent {
final Interaction interaction) {
final Timestamp timestamp = clockService.nowAsJavaSqlTimestamp();
- final String userName = getAuthenticationSession().getUserName();
+ final String userName = userService.getUser().getName();
command.setTimestamp(timestamp);
command.setUser(userName);
command.setTransactionId(transactionId);
interaction.setTransactionId(transactionId);
-
}
http://git-wip-us.apache.org/repos/asf/isis/blob/b01781b0/core/schema/pom.xml
----------------------------------------------------------------------
diff --git a/core/schema/pom.xml b/core/schema/pom.xml
index 9455642..593aa85 100644
--- a/core/schema/pom.xml
+++ b/core/schema/pom.xml
@@ -45,7 +45,9 @@
<profile>
<id>xsd-to-java</id>
<activation>
- <activeByDefault>true</activeByDefault>
+ <property>
+ <name>!skip.xsd-to-java</name>
+ </property>
</activation>
<build>
@@ -68,19 +70,22 @@
<artifactId>maven-jaxb2-plugin</artifactId>
<executions>
<execution>
- <id>generate-ixn-xsd</id>
+ <id>generate-chg-xsd</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
- <schemaDirectory>src/main/resources/org/apache/isis/schema/ixn</schemaDirectory>
+ <schemaDirectory>src/main/resources/org/apache/isis/schema</schemaDirectory>
<schemaIncludes>
- <schemaInclude>ixn-1.0.xsd</schemaInclude>
+ <schemaInclude>common/common-1.0.xsd</schemaInclude>
+ <schemaInclude>cmd/cmd-1.0.xsd</schemaInclude>
+ <schemaInclude>ixn/ixn-1.0.xsd</schemaInclude>
+ <schemaInclude>chg/chg-1.0.xsd</schemaInclude>
</schemaIncludes>
- <bindingDirectory>src/main/resources/org/apache/isis/schema/ixn</bindingDirectory>
+ <bindingDirectory>src/main/resources/org/apache/isis/schema</bindingDirectory>
<bindingIncludes>
- <bindingInclude>ixn-1.0-binding.xml</bindingInclude>
+ <bindingInclude>bindings.xml</bindingInclude>
</bindingIncludes>
<args>
<arg>-extension</arg>
http://git-wip-us.apache.org/repos/asf/isis/blob/b01781b0/core/schema/src/main/resources/org/apache/isis/schema/bindings.xml
----------------------------------------------------------------------
diff --git a/core/schema/src/main/resources/org/apache/isis/schema/bindings.xml b/core/schema/src/main/resources/org/apache/isis/schema/bindings.xml
new file mode 100644
index 0000000..92ffed9
--- /dev/null
+++ b/core/schema/src/main/resources/org/apache/isis/schema/bindings.xml
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ jaxb:version="2.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:namespace="http://jaxb2-commons.dev.java.net/namespace-prefix"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd
+ http://jaxb2-commons.dev.java.net/namespace-prefix http://java.net/projects/jaxb2-commons/sources/svn/content/namespace-prefix/trunk/src/main/resources/prefix-namespace-schema.xsd"
+>
+ <jaxb:bindings schemaLocation="chg/chg-1.0.xsd">
+ <jaxb:schemaBindings>
+ <!--
+ we don't include the minor version, because the
+ generated Java class will be backwards compatible
+ -->
+ <jaxb:package name="org.apache.isis.schema.chg.v1"/>
+ </jaxb:schemaBindings>
+ <jaxb:bindings>
+ <namespace:prefix name="chg" />
+ </jaxb:bindings>
+ </jaxb:bindings>
+
+ <jaxb:bindings schemaLocation="ixn/ixn-1.0.xsd">
+ <jaxb:schemaBindings>
+ <!--
+ we don't include the minor version, because the
+ generated Java class will be backwards compatible
+ -->
+ <jaxb:package name="org.apache.isis.schema.ixn.v1"/>
+ </jaxb:schemaBindings>
+ <jaxb:bindings>
+ <namespace:prefix name="ixn" />
+ </jaxb:bindings>
+ </jaxb:bindings>
+ <!-- since ixn-1.0.xsd does an xs:import of common-1.0.xsd, we need to specify common's package bindings -->
+ <jaxb:bindings schemaLocation="common/common-1.0.xsd">
+ <jaxb:schemaBindings>
+ <!--
+ we don't include the minor version, because the
+ generated Java class will be backwards compatible
+ -->
+ <jaxb:package name="org.apache.isis.schema.common.v1"/>
+ </jaxb:schemaBindings>
+ <jaxb:bindings>
+ <namespace:prefix name="com" />
+ </jaxb:bindings>
+ </jaxb:bindings>
+ <!-- since ixn-1.0.xsd does an xs:import of cmd-1.0.xsd, we need to specify common's package bindings -->
+ <jaxb:bindings schemaLocation="cmd/cmd-1.0.xsd">
+ <jaxb:schemaBindings>
+ <!--
+ we don't include the minor version, because the
+ generated Java class will be backwards compatible
+ -->
+ <jaxb:package name="org.apache.isis.schema.cmd.v1"/>
+ </jaxb:schemaBindings>
+ <jaxb:bindings>
+ <namespace:prefix name="cmd" />
+ </jaxb:bindings>
+ </jaxb:bindings>
+</jaxb:bindings>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/b01781b0/core/schema/src/main/resources/org/apache/isis/schema/chg/chg-1.0.xsd
----------------------------------------------------------------------
diff --git a/core/schema/src/main/resources/org/apache/isis/schema/chg/chg-1.0.xsd b/core/schema/src/main/resources/org/apache/isis/schema/chg/chg-1.0.xsd
new file mode 100644
index 0000000..2d48016
--- /dev/null
+++ b/core/schema/src/main/resources/org/apache/isis/schema/chg/chg-1.0.xsd
@@ -0,0 +1,82 @@
+\ufeff<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<xs:schema targetNamespace="http://isis.apache.org/schema/chg"
+ elementFormDefault="qualified"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns="http://isis.apache.org/schema/chg"
+ xmlns:com="http://isis.apache.org/schema/common"
+ >
+
+ <xs:import namespace="http://isis.apache.org/schema/common" schemaLocation="../common/common-1.0.xsd"/>
+
+ <xs:element name="changesDto">
+ <xs:annotation>
+ <xs:documentation>The changes (create/update/delete) to one or more domain objects within a transaction. (nb: only published objects are included in these lists).
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="majorVersion" type="xs:string" minOccurs="0" maxOccurs="1" default="1">
+ <xs:annotation>
+ <xs:documentation>The major version of the schema that an XML instance was created using.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="minorVersion" type="xs:string" minOccurs="0" maxOccurs="1" default="0">
+ <xs:annotation>
+ <xs:documentation>The minor version of the schema that an XML instance was created using.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="transactionId" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Transaction id within which this change occurred.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="created" type="com:oidsDto">
+ <xs:annotation>
+ <xs:documentation>The list of objects created within the transaction.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="updated" type="com:oidsDto">
+ <xs:annotation>
+ <xs:documentation>The list of objects updated within the transaction.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="deleted" type="com:oidsDto">
+ <xs:annotation>
+ <xs:documentation>The list of objects deleted within the transaction.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="user" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>The name of the user that performed this transaction.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+</xs:schema>
http://git-wip-us.apache.org/repos/asf/isis/blob/b01781b0/core/schema/src/main/resources/org/apache/isis/schema/cmd/cmd-1.0-binding.xml
----------------------------------------------------------------------
diff --git a/core/schema/src/main/resources/org/apache/isis/schema/cmd/cmd-1.0-binding.xml b/core/schema/src/main/resources/org/apache/isis/schema/cmd/cmd-1.0-binding.xml
deleted file mode 100644
index 46e52fb..0000000
--- a/core/schema/src/main/resources/org/apache/isis/schema/cmd/cmd-1.0-binding.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- jaxb:version="2.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:namespace="http://jaxb2-commons.dev.java.net/namespace-prefix"
- xsi:schemaLocation="http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd
- http://jaxb2-commons.dev.java.net/namespace-prefix http://java.net/projects/jaxb2-commons/sources/svn/content/namespace-prefix/trunk/src/main/resources/prefix-namespace-schema.xsd"
- >
- <jaxb:bindings schemaLocation="cmd-1.0.xsd">
- <jaxb:schemaBindings>
- <!--
- we don't include the minor version, because the
- generated Java class will be backwards compatible
- -->
- <jaxb:package name="org.apache.isis.schema.cmd.v1"/>
- </jaxb:schemaBindings>
- <jaxb:bindings>
- <namespace:prefix name="cmd" />
- </jaxb:bindings>
- </jaxb:bindings>
- <!-- since cmd-1.0.xsd does an xs:import of common-1.0.xsd, we need to specify common's package bindings -->
- <jaxb:bindings schemaLocation="../common/common-1.0.xsd">
- <jaxb:schemaBindings>
- <!--
- we don't include the minor version, because the
- generated Java class will be backwards compatible
- -->
- <jaxb:package name="org.apache.isis.schema.common.v1"/>
- </jaxb:schemaBindings>
- <jaxb:bindings>
- <namespace:prefix name="com" />
- </jaxb:bindings>
- </jaxb:bindings>
-</jaxb:bindings>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/b01781b0/core/schema/src/main/resources/org/apache/isis/schema/common/common-1.0.xsd
----------------------------------------------------------------------
diff --git a/core/schema/src/main/resources/org/apache/isis/schema/common/common-1.0.xsd b/core/schema/src/main/resources/org/apache/isis/schema/common/common-1.0.xsd
index ecf6b01..041208c 100644
--- a/core/schema/src/main/resources/org/apache/isis/schema/common/common-1.0.xsd
+++ b/core/schema/src/main/resources/org/apache/isis/schema/common/common-1.0.xsd
@@ -188,5 +188,4 @@
</xs:restriction>
</xs:simpleType>
-
</xs:schema>
http://git-wip-us.apache.org/repos/asf/isis/blob/b01781b0/core/schema/src/main/resources/org/apache/isis/schema/ixn/ixn-1.0-binding.xml
----------------------------------------------------------------------
diff --git a/core/schema/src/main/resources/org/apache/isis/schema/ixn/ixn-1.0-binding.xml b/core/schema/src/main/resources/org/apache/isis/schema/ixn/ixn-1.0-binding.xml
deleted file mode 100644
index aac88f8..0000000
--- a/core/schema/src/main/resources/org/apache/isis/schema/ixn/ixn-1.0-binding.xml
+++ /dev/null
@@ -1,66 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- jaxb:version="2.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:namespace="http://jaxb2-commons.dev.java.net/namespace-prefix"
- xsi:schemaLocation="http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd
- http://jaxb2-commons.dev.java.net/namespace-prefix http://java.net/projects/jaxb2-commons/sources/svn/content/namespace-prefix/trunk/src/main/resources/prefix-namespace-schema.xsd"
->
- <jaxb:bindings schemaLocation="ixn-1.0.xsd">
- <jaxb:schemaBindings>
- <!--
- we don't include the minor version, because the
- generated Java class will be backwards compatible
- -->
- <jaxb:package name="org.apache.isis.schema.ixn.v1"/>
- </jaxb:schemaBindings>
- <jaxb:bindings>
- <namespace:prefix name="ixn" />
- </jaxb:bindings>
- </jaxb:bindings>
- <!-- since ixn-1.0.xsd does an xs:import of common-1.0.xsd, we need to specify common's package bindings -->
- <jaxb:bindings schemaLocation="../common/common-1.0.xsd">
- <jaxb:schemaBindings>
- <!--
- we don't include the minor version, because the
- generated Java class will be backwards compatible
- -->
- <jaxb:package name="org.apache.isis.schema.common.v1"/>
- </jaxb:schemaBindings>
- <jaxb:bindings>
- <namespace:prefix name="com" />
- </jaxb:bindings>
- </jaxb:bindings>
- <!-- since ixn-1.0.xsd does an xs:import of cmd-1.0.xsd, we need to specify common's package bindings -->
- <jaxb:bindings schemaLocation="../cmd/cmd-1.0.xsd">
- <jaxb:schemaBindings>
- <!--
- we don't include the minor version, because the
- generated Java class will be backwards compatible
- -->
- <jaxb:package name="org.apache.isis.schema.cmd.v1"/>
- </jaxb:schemaBindings>
- <jaxb:bindings>
- <namespace:prefix name="cmd" />
- </jaxb:bindings>
- </jaxb:bindings>
-</jaxb:bindings>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/b01781b0/core/schema/src/main/resources/org/apache/isis/schema/ixn/ixn-1.0.xsd
----------------------------------------------------------------------
diff --git a/core/schema/src/main/resources/org/apache/isis/schema/ixn/ixn-1.0.xsd b/core/schema/src/main/resources/org/apache/isis/schema/ixn/ixn-1.0.xsd
index 76443e0..f59a5a5 100644
--- a/core/schema/src/main/resources/org/apache/isis/schema/ixn/ixn-1.0.xsd
+++ b/core/schema/src/main/resources/org/apache/isis/schema/ixn/ixn-1.0.xsd
@@ -35,7 +35,7 @@
</xs:annotation>
<xs:complexType>
<xs:sequence>
- <xs:element name="majorVersion" type="xs:string" minOccurs="0" maxOccurs="1" default="2">
+ <xs:element name="majorVersion" type="xs:string" minOccurs="0" maxOccurs="1" default="1">
<xs:annotation>
<xs:documentation>The major version of the schema that an XML instance was created using.
</xs:documentation>
http://git-wip-us.apache.org/repos/asf/isis/blob/b01781b0/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.java b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.java
index 4c303d4..cf29db3 100644
--- a/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.java
+++ b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.java
@@ -24,6 +24,7 @@ import javax.jdo.annotations.VersionStrategy;
import org.apache.isis.applib.annotation.Action;
import org.apache.isis.applib.annotation.DomainObject;
import org.apache.isis.applib.annotation.Property;
+import org.apache.isis.applib.annotation.Publishing;
import org.apache.isis.applib.annotation.SemanticsOf;
import org.apache.isis.applib.services.eventbus.ActionDomainEvent;
import org.apache.isis.applib.services.eventbus.PropertyDomainEvent;
@@ -55,7 +56,9 @@ import org.apache.isis.applib.util.ObjectContracts;
+ "WHERE name.indexOf(:name) >= 0 ")
})
@javax.jdo.annotations.Unique(name="SimpleObject_name_UNQ", members = {"name"})
-@DomainObject
+@DomainObject(
+ publishing = Publishing.ENABLED
+)
public class SimpleObject implements Comparable<SimpleObject> {
public static final int NAME_LENGTH = 40;
http://git-wip-us.apache.org/repos/asf/isis/blob/b01781b0/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/logging.properties
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/logging.properties b/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/logging.properties
index b58eb7a..5d663ef 100644
--- a/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/logging.properties
+++ b/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/logging.properties
@@ -75,6 +75,17 @@ log4j.appender.wicket.i18n.layout=org.apache.log4j.PatternLayout
log4j.appender.wicket.i18n.layout.ConversionPattern=%d [%-20c{1} %-10t %-5p] %m%n
+log4j.appender.PublisherServiceLogging=org.apache.log4j.FileAppender
+log4j.appender.PublisherServiceLogging.File=./logs/PublisherServiceLogging.log
+log4j.appender.PublisherServiceLogging.Append=false
+log4j.appender.PublisherServiceLogging.layout=org.apache.log4j.PatternLayout
+log4j.appender.PublisherServiceLogging.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss.SSS} %m%n
+
+
+# profiling via PublisherService
+log4j.logger.org.apache.isis.applib.services.publish.PublisherServiceLogging=DEBUG,PublisherServiceLogging
+log4j.additivity.log4j.logger.org.apache.isis.applib.services.publish.PublisherServiceLogging=false
+
@@ -190,9 +201,6 @@ log4j.additivity.org.apache.isis.core.runtime.installers.InstallerLookupDefault=
log4j.logger.org.apache.shiro.realm.AuthorizingRealm=WARN,Console
log4j.additivity.log4j.logger.org.apache.shiro.realm.AuthorizingRealm=false
-# profiling via PublisherService
-log4j.logger.org.apache.isis.applib.services.publish.PublisherServiceLogging=DEBUG,Console
-log4j.additivity.log4j.logger.org.apache.isis.applib.services.publish.PublisherServiceLogging=false
# Application-specific logging
log4j.logger.dom.simple.SimpleObject=DEBUG, Stderr