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 2013/03/28 11:35:37 UTC
[13/20] ISIS-381: mothballing HTML viewer, SQL security, LDAP security
http://git-wip-us.apache.org/repos/asf/isis/blob/91a8000b/component/viewer/html/impl/src/test/java/org/apache/isis/viewer/html/context/ContextTest_mapCollection.java
----------------------------------------------------------------------
diff --git a/component/viewer/html/impl/src/test/java/org/apache/isis/viewer/html/context/ContextTest_mapCollection.java b/component/viewer/html/impl/src/test/java/org/apache/isis/viewer/html/context/ContextTest_mapCollection.java
deleted file mode 100644
index b1cf314..0000000
--- a/component/viewer/html/impl/src/test/java/org/apache/isis/viewer/html/context/ContextTest_mapCollection.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * 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.viewer.html.context;
-
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.hamcrest.CoreMatchers.not;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
-
-import java.util.List;
-
-import com.google.common.collect.Lists;
-
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.integtestsupport.IsisSystemWithFixtures;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
-import org.apache.isis.core.metamodel.adapter.oid.Oid;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
-import org.apache.isis.core.tck.dom.refs.SimpleEntity;
-import org.apache.isis.viewer.html.action.ActionException;
-
-public class ContextTest_mapCollection {
-
- @Rule
- public IsisSystemWithFixtures iswf = IsisSystemWithFixtures.builder().build();
-
- private Context context;
-
- @Before
- public void setUp() throws Exception {
- Logger.getRootLogger().setLevel(Level.OFF);
- context = new Context(null);
- }
-
- @Test
- public void getMappedCollection_forNonExistentId() {
-
-
- try {
- assertNull(context.getMappedCollection("NON-EXISTENT-ID"));
- fail();
- } catch (final ActionException ex) {
- // expected
- }
- }
-
- @Test
- public void mapCollection_then_getMappedCollection() throws Exception {
-
- // given
- iswf.persist(iswf.fixtures.smpl1);
- iswf.persist(iswf.fixtures.smpl2);
-
- final List<SimpleEntity> collection = Lists.newArrayList();
- collection.add(iswf.fixtures.smpl1);
- collection.add(iswf.fixtures.smpl2);
-
- final Oid oid1 = getAdapterManager().adapterFor(iswf.fixtures.smpl1).getOid();
- final Oid oid2 = getAdapterManager().adapterFor(iswf.fixtures.smpl2).getOid();
-
- final ObjectAdapter collectionAdapter = getAdapterManager().adapterFor(collection);
- final String id = context.mapCollection(collectionAdapter);
-
- iswf.bounceSystem();
-
- // when
- final ObjectAdapter mappedCollection = context.getMappedCollection(id);
-
- // then
- final List<?> list = (List<?>) mappedCollection.getObject();
-
- final Oid oid1Remapped = getAdapterManager().adapterFor(list.get(0)).getOid();
- final Oid oid2Remapped = getAdapterManager().adapterFor(list.get(1)).getOid();
- assertEquals(oid1, oid1Remapped);
- assertEquals(oid2, oid2Remapped);
- }
-
-
-
- @Test
- public void testRegisteredCollectionReturnSameIdentityForSameCollection() {
-
- // given
- iswf.persist(iswf.fixtures.smpl1);
- iswf.persist(iswf.fixtures.smpl2);
-
- final List<SimpleEntity> collection = Lists.newArrayList();
- collection.add(iswf.fixtures.smpl1);
- collection.add(iswf.fixtures.smpl2);
-
- final ObjectAdapter collectionAdapter = getAdapterManager().adapterFor(collection);
-
- // when
- final String id = context.mapCollection(collectionAdapter);
- final String id2 = context.mapCollection(collectionAdapter);
-
- // then
- assertEquals(id, id2);
- }
-
- @Test
- public void testRegisteredCollectionReturnDifferentIdentityForDifferentCollection() {
-
- // given
- iswf.persist(iswf.fixtures.smpl1);
- iswf.persist(iswf.fixtures.smpl2);
-
- final List<SimpleEntity> collection1 = Lists.newArrayList();
- collection1.add(iswf.fixtures.smpl1);
- final ObjectAdapter collection1Adapter = getAdapterManager().adapterFor(collection1);
-
- final List<SimpleEntity> collection2 = Lists.newArrayList();
- collection2.add(iswf.fixtures.smpl2);
- final ObjectAdapter collection2Adapter = getAdapterManager().adapterFor(collection2);
-
- // when
- final String id = context.mapCollection(collection1Adapter);
- final String id2 = context.mapCollection(collection2Adapter);
-
- // then
- assertThat(id, not(equalTo(id2)));
- }
-
-
- private PersistenceSession getPersistenceSession() {
- return IsisContext.getPersistenceSession();
- }
-
- private AdapterManager getAdapterManager() {
- return getPersistenceSession().getAdapterManager();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/91a8000b/component/viewer/html/impl/src/test/java/org/apache/isis/viewer/html/context/ContextTest_mapObject.java
----------------------------------------------------------------------
diff --git a/component/viewer/html/impl/src/test/java/org/apache/isis/viewer/html/context/ContextTest_mapObject.java b/component/viewer/html/impl/src/test/java/org/apache/isis/viewer/html/context/ContextTest_mapObject.java
deleted file mode 100644
index 1f8dc06..0000000
--- a/component/viewer/html/impl/src/test/java/org/apache/isis/viewer/html/context/ContextTest_mapObject.java
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- * 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.viewer.html.context;
-
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
-
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.integtestsupport.IsisSystemWithFixtures;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.ResolveState;
-import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
-import org.apache.isis.core.metamodel.adapter.oid.Oid;
-import org.apache.isis.core.metamodel.adapter.version.Version;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
-import org.apache.isis.viewer.html.action.ActionException;
-
-public class ContextTest_mapObject {
-
- @Rule
- public IsisSystemWithFixtures iswf = IsisSystemWithFixtures.builder().build();
-
- private ObjectAdapter originalAdapter;
- private Oid oid;
- private ObjectAdapter restoredAdapter;
-
- private Context context;
-
- @Before
- public void setUp() throws Exception {
- Logger.getRootLogger().setLevel(Level.OFF);
- context = new Context(null);
- }
-
- @Test
- public void mapObject_then_restoreAllObjectsToLoader() throws Exception {
-
- // given
- originalAdapter = getAdapterManager().adapterFor(iswf.fixtures.smpl1);
- oid = originalAdapter.getOid();
- context.mapObject(originalAdapter);
-
- iswf.bounceSystem();
-
- // when
- context.restoreAllObjectsToLoader();
- restoredAdapter = getAdapterManager().getAdapterFor(oid);
-
- assertNotNull("loaders is missing the object", getAdapterManager().getAdapterFor(oid));
- assertNotSame("expect the loader to have a new adapter", originalAdapter, restoredAdapter);
-
- // then
- assertEquals(originalAdapter.getOid(), restoredAdapter.getOid());
- assertNotSame(originalAdapter, restoredAdapter);
- assertEquals(originalAdapter.getObject().getClass(), restoredAdapter.getObject().getClass());
- assertEquals(originalAdapter.getVersion(), restoredAdapter.getVersion());
- assertEquals(ResolveState.TRANSIENT, restoredAdapter.getResolveState());
- }
-
-
- @Test
- public void mapObject_forTransient_then_getMappedObject_byId() {
-
- // given
- originalAdapter = getAdapterManager().adapterFor(iswf.fixtures.smpl1);
- oid = originalAdapter.getOid();
- final String id = context.mapObject(originalAdapter);
-
- // when
- restoredAdapter = context.getMappedObject(id);
-
- // then
- assertEquals(originalAdapter, restoredAdapter);
- }
-
-
- @Test
- public void mapObject_forPersistent_then_getMappedObject_byId() {
-
- // given
- iswf.persist(iswf.fixtures.smpl1);
-
- originalAdapter = getAdapterManager().adapterFor(iswf.fixtures.smpl1);
- oid = originalAdapter.getOid();
- final String id = context.mapObject(originalAdapter);
-
- // when
- restoredAdapter = context.getMappedObject(id);
-
- // then
- assertEquals(originalAdapter, restoredAdapter);
- }
-
-
- @Test
- public void getMappedObject_forPersistent_whenChanged() throws Exception {
-
- // given
- iswf.persist(iswf.fixtures.smpl1);
-
- originalAdapter = getAdapterManager().adapterFor(iswf.fixtures.smpl1);
- final Oid oid = originalAdapter.getOid();
- final String id = context.mapObject(originalAdapter);
-
- final Version version = originalAdapter.getVersion();
-
- iswf.fixtures.smpl1.setName("changed date");
- iswf.bounceSystem(); // does a commit, which will bump the version
-
- originalAdapter = getAdapterManager().getAdapterFor(oid);
-
- final Version version2 = originalAdapter.getVersion();
-
- assertThat(version.different(version2), is(true));
-
-
- // when
- restoredAdapter = context.getMappedObject(id);
- final String message = context.getMessage(1);
-
- // then
- assertEquals("Reloaded object " + restoredAdapter.titleString(), message);
- }
-
-
- @Test
- public void mapObject_forTransient_alwaysReturnsSameId() {
-
- // given
- originalAdapter = getAdapterManager().adapterFor(iswf.fixtures.smpl1);
-
- // when
- final String id = context.mapObject(originalAdapter);
- final String id2 = context.mapObject(originalAdapter);
-
- // then
- assertEquals(id, id2);
- }
-
-
- @Test
- public void mapObject_forPersistent_alwaysReturnsSameId() {
-
- // given
- iswf.persist(iswf.fixtures.smpl1);
-
- originalAdapter = getAdapterManager().adapterFor(iswf.fixtures.smpl1);
-
- // when
- final String id = context.mapObject(originalAdapter);
- final String id2 = context.mapObject(originalAdapter);
-
- // then
- assertEquals(id, id2);
- }
-
-
- @Test
- public void mapObject_forTransient_returnsDifferentIdsForDifferentObjects() {
-
- // when
- final String id = context.mapObject(getAdapterManager().adapterFor(iswf.fixtures.smpl1));
- final String id2 = context.mapObject(getAdapterManager().adapterFor(iswf.fixtures.smpl2));
-
- // then
- assertThat(id, not(equalTo(id2)));
- }
-
-
- @Test
- public void mapObject_forPersistent_returnsDifferentIdsForDifferentObjects() {
-
- // given
- iswf.persist(iswf.fixtures.smpl1);
- iswf.persist(iswf.fixtures.smpl2);
-
- // when
- final String id = context.mapObject(getAdapterManager().adapterFor(iswf.fixtures.smpl1));
- final String id2 = context.mapObject(getAdapterManager().adapterFor(iswf.fixtures.smpl2));
-
- // then
- assertThat(id, not(equalTo(id2)));
- }
-
-
- @Test
- public void restoreAllObjectsToLoader_restoredAsGhosts() throws Exception {
-
- // given
- iswf.persist(iswf.fixtures.smpl1);
- originalAdapter = getAdapterManager().adapterFor(iswf.fixtures.smpl1);
- oid = originalAdapter.getOid();
-
- iswf.bounceSystem();
-
- // when
- context.restoreAllObjectsToLoader();
-
- // then
- restoredAdapter = getAdapterManager().getAdapterFor(oid);
-
- assertEquals("expect versions to match", originalAdapter.getVersion(), restoredAdapter.getVersion());
- assertEquals(ResolveState.GHOST, restoredAdapter.getResolveState());
- }
-
-
-
- @Test
- public void testExceptionThrownWhenNoActionForIdentity() {
-
- iswf.persist(iswf.fixtures.smpl1);
- iswf.persist(iswf.fixtures.smpl2);
-
- // when
- context.mapObject(getAdapterManager().adapterFor(iswf.fixtures.smpl1));
-
- try {
- assertNull(context.getMappedObject("NON-EXISTENT-ID"));
- fail();
- } catch (final ActionException ex) {
- // expected
- }
- }
-
-
-
- private PersistenceSession getPersistenceSession() {
- return IsisContext.getPersistenceSession();
- }
-
- private AdapterManager getAdapterManager() {
- return getPersistenceSession().getAdapterManager();
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/isis/blob/91a8000b/component/viewer/html/impl/src/test/java/org/apache/isis/viewer/html/context/ContextTest_serialization.java
----------------------------------------------------------------------
diff --git a/component/viewer/html/impl/src/test/java/org/apache/isis/viewer/html/context/ContextTest_serialization.java b/component/viewer/html/impl/src/test/java/org/apache/isis/viewer/html/context/ContextTest_serialization.java
deleted file mode 100644
index 1ef838f..0000000
--- a/component/viewer/html/impl/src/test/java/org/apache/isis/viewer/html/context/ContextTest_serialization.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * 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.viewer.html.context;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-import java.io.OutputStream;
-
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.jmock.Expectations;
-import org.jmock.auto.Mock;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.commons.config.IsisConfiguration;
-import org.apache.isis.core.integtestsupport.IsisSystemWithFixtures;
-import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
-import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
-import org.apache.isis.viewer.html.HtmlViewerConstants;
-import org.apache.isis.viewer.html.PathBuilder;
-import org.apache.isis.viewer.html.PathBuilderDefault;
-import org.apache.isis.viewer.html.component.ComponentFactory;
-import org.apache.isis.viewer.html.component.html.HtmlComponentFactory;
-
-public class ContextTest_serialization {
-
- @Rule
- public IsisSystemWithFixtures iswf = IsisSystemWithFixtures.builder().build();
-
- @Rule
- public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_ONLY);
-
- @Mock
- private IsisConfiguration isisConfiguration;
-
- private ComponentFactory factory;
- private PathBuilder pathBuilder;
-
- private Context viewerContext;
-
- @Before
- public void setUp() throws Exception {
- Logger.getRootLogger().setLevel(Level.OFF);
-
- pathBuilder = new PathBuilderDefault("shtml");
- context.checking(new Expectations() {
- {
- allowing(isisConfiguration).getString(HtmlViewerConstants.STYLE_SHEET);
- will(returnValue("someStyleSheet.css"));
-
- allowing(isisConfiguration).getString(HtmlViewerConstants.HEADER_FILE);
- will(returnValue(null));
-
- allowing(isisConfiguration).getString(HtmlViewerConstants.HEADER);
- will(returnValue("<div></div>"));
-
- allowing(isisConfiguration).getString(HtmlViewerConstants.FOOTER_FILE);
- will(returnValue(null));
-
- allowing(isisConfiguration).getString(HtmlViewerConstants.FOOTER);
- will(returnValue("<div></div>"));
- }
- });
-
- factory = new HtmlComponentFactory(pathBuilder, isisConfiguration);
-
- viewerContext = new Context(factory);
- }
-
-
- @Test
- public void writeObject() throws IOException {
- OutputStream baos = new ByteArrayOutputStream();
- final ObjectOutputStream objectOutputStream = new ObjectOutputStream(baos);
- objectOutputStream.writeObject(viewerContext);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/91a8000b/component/viewer/html/impl/src/test/java/org/apache/isis/viewer/html/context/ObjectActionNoop.java
----------------------------------------------------------------------
diff --git a/component/viewer/html/impl/src/test/java/org/apache/isis/viewer/html/context/ObjectActionNoop.java b/component/viewer/html/impl/src/test/java/org/apache/isis/viewer/html/context/ObjectActionNoop.java
deleted file mode 100644
index 2927c28..0000000
--- a/component/viewer/html/impl/src/test/java/org/apache/isis/viewer/html/context/ObjectActionNoop.java
+++ /dev/null
@@ -1,312 +0,0 @@
-/*
- * 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.viewer.html.context;
-
-import java.util.List;
-
-import org.apache.isis.applib.Identifier;
-import org.apache.isis.applib.annotation.ActionSemantics;
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.applib.filter.Filter;
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.consent.Allow;
-import org.apache.isis.core.metamodel.consent.Consent;
-import org.apache.isis.core.metamodel.consent.InteractionInvocationMethod;
-import org.apache.isis.core.metamodel.facetapi.Facet;
-import org.apache.isis.core.metamodel.facetapi.FeatureType;
-import org.apache.isis.core.metamodel.facetapi.MultiTypedFacet;
-import org.apache.isis.core.metamodel.interactions.ActionInvocationContext;
-import org.apache.isis.core.metamodel.interactions.UsabilityContext;
-import org.apache.isis.core.metamodel.interactions.VisibilityContext;
-import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
-import org.apache.isis.core.metamodel.spec.ActionType;
-import org.apache.isis.core.metamodel.spec.Instance;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
-import org.apache.isis.core.metamodel.spec.feature.ObjectActionParameter;
-
-/**
- * Has no functionality but makes it easier to write tests that require an
- * instance of an {@link Identifier}.
- *
- * <p>
- * Was previously DummyAction, in the web viewer project. Only used by tests
- * there.
- */
-public class ObjectActionNoop implements ObjectAction {
-
- public boolean[] canParametersWrap() {
- return null;
- }
-
- @Override
- public String debugData() {
- return null;
- }
-
- @Override
- public ObjectAdapter execute(final ObjectAdapter target, final ObjectAdapter[] parameters) {
- return null;
- }
-
- @Override
- public List<ObjectAction> getActions() {
- return null;
- }
-
- @Override
- public ObjectAdapter[] getDefaults(final ObjectAdapter target) {
- return null;
- }
-
- @Override
- public String getDescription() {
- return null;
- }
-
- @Override
- public boolean containsFacet(final Class<? extends Facet> facetType) {
- return false;
- }
-
- @Override
- public boolean containsDoOpFacet(final Class<? extends Facet> facetType) {
- return false;
- }
-
- @Override
- public <T extends Facet> T getFacet(final Class<T> cls) {
- return null;
- }
-
- @Override
- public Class<? extends Facet>[] getFacetTypes() {
- return new Class[0];
- }
-
- @Override
- public List<Facet> getFacets(final Filter<Facet> filter) {
- return null;
- }
-
- @Override
- public void addFacet(final Facet facet) {
- }
-
- @Override
- public void addFacet(final MultiTypedFacet facet) {
- }
-
- @Override
- public void removeFacet(final Facet facet) {
- }
-
- @Override
- public void removeFacet(final Class<? extends Facet> facetType) {
- }
-
- @Override
- public Identifier getIdentifier() {
- return null;
- }
-
- @Override
- public String getHelp() {
- return null;
- }
-
- @Override
- public String getId() {
- return null;
- }
-
- @Override
- public String getName() {
- return null;
- }
-
- @Override
- public ObjectSpecification getOnType() {
- return null;
- }
-
- @Override
- public ObjectAdapter[][] getChoices(final ObjectAdapter target) {
- return null;
- }
-
- @Override
- public int getParameterCount() {
- return 0;
- }
-
- @Override
- public List<ObjectActionParameter> getParameters() {
- return null;
- }
-
- @Override
- public List<ObjectActionParameter> getParameters(final Filter<ObjectActionParameter> filter) {
- return null;
- }
-
- @Override
- public ObjectActionParameter getParameterById(final String paramId) {
- return null;
- }
-
- @Override
- public ObjectActionParameter getParameterByName(final String paramName) {
- return null;
- }
-
- @Override
- public ObjectSpecification getReturnType() {
- return null;
- }
-
- @Override
- public ActionType getType() {
- return null;
- }
-
- @Override
- public boolean hasReturn() {
- return false;
- }
-
- @Override
- public boolean isContributed() {
- return false;
- }
-
- @Override
- public boolean promptForParameters(final ObjectAdapter target) {
- return false;
- }
-
- @Override
- public VisibilityContext<?> createVisibleInteractionContext(final AuthenticationSession session, final InteractionInvocationMethod invocationMethod, final ObjectAdapter targetObjectAdapter, Where where) {
- return null;
- }
-
- @Override
- public boolean isAlwaysHidden() {
- return false;
- }
-
- @Override
- public Consent isVisible(final AuthenticationSession session, final ObjectAdapter target, Where where) {
- return Allow.DEFAULT;
- }
-
- @Override
- public Consent isUsable(final AuthenticationSession session, final ObjectAdapter target, Where where) {
- return Allow.DEFAULT;
- }
-
- @Override
- public Consent isProposedArgumentSetValid(final ObjectAdapter object, final ObjectAdapter[] parameters) {
- return Allow.DEFAULT;
- }
-
- @Override
- public ObjectAdapter realTarget(final ObjectAdapter target) {
- return target;
- }
-
- @Override
- public ObjectSpecification getSpecification() {
- return null;
- }
-
- @Override
- public UsabilityContext<?> createUsableInteractionContext(final AuthenticationSession session, final InteractionInvocationMethod invocationMethod, final ObjectAdapter target, Where where) {
- return null;
- }
-
- @Override
- public ActionInvocationContext createActionInvocationInteractionContext(final AuthenticationSession session, final InteractionInvocationMethod invocationMethod, final ObjectAdapter object, final ObjectAdapter[] candidateArguments) {
- return null;
- }
-
- // /////////////////////////////////////////////////////////////
- // isAction, isAssociation
- // /////////////////////////////////////////////////////////////
-
- @Override
- public boolean isAction() {
- return true;
- }
-
- @Override
- public boolean isPropertyOrCollection() {
- return false;
- }
-
- @Override
- public boolean isOneToManyAssociation() {
- return false;
- }
-
- @Override
- public boolean isOneToOneAssociation() {
- return false;
- }
-
- // /////////////////////////////////////////////////////////////
- // getInstance
- // /////////////////////////////////////////////////////////////
-
- @Override
- public Instance getInstance(final ObjectAdapter adapter) {
- final ObjectAction specification = this;
- return adapter.getInstance(specification);
- }
-
- @Override
- public List<ObjectSpecification> getParameterTypes() {
- return null;
- }
-
- public RuntimeContext getRuntimeContext() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.isis.core.metamodel.spec.feature.ObjectFeature#getFeatureType
- * ()
- */
- @Override
- public FeatureType getFeatureType() {
- return FeatureType.ACTION;
- }
-
- @Override
- public ActionSemantics.Of getSemantics() {
- return ActionSemantics.Of.NON_IDEMPOTENT;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/91a8000b/component/viewer/html/impl/src/test/java/org/apache/isis/viewer/html/request/ImageProviderResourceBasedTest.java
----------------------------------------------------------------------
diff --git a/component/viewer/html/impl/src/test/java/org/apache/isis/viewer/html/request/ImageProviderResourceBasedTest.java b/component/viewer/html/impl/src/test/java/org/apache/isis/viewer/html/request/ImageProviderResourceBasedTest.java
deleted file mode 100644
index 5bcb836..0000000
--- a/component/viewer/html/impl/src/test/java/org/apache/isis/viewer/html/request/ImageProviderResourceBasedTest.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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.viewer.html.request;
-
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.junit.Assert.assertThat;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import org.apache.isis.viewer.html.image.ImageProviderResourceBased;
-
-public class ImageProviderResourceBasedTest {
-
- private ImageProviderResourceBased imageProvider;
-
- @Before
- public void setUp() {
- imageProvider = new ImageProviderResourceBased();
- }
-
- @After
- public void tearDown() {
- imageProvider = null;
- }
-
- @Test
- public void canFindDefaultExplicitly() {
- assertThat(imageProvider.image("Default"), equalTo("images/Default.png"));
- }
-
- @Test
- public void nonExistentImageUsesDefault() {
- assertThat(imageProvider.image("NonExistent"), equalTo("images/Default.png"));
- }
-
- @Test
- public void nonDefaultPngExistingImageIsReturned() {
- assertThat(imageProvider.image("Service"), equalTo("images/Service.png"));
- }
-
- @Test
- public void nonDefaultGifExistingImageIsReturned() {
- assertThat(imageProvider.image("Customer"), equalTo("images/Customer.gif"));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/91a8000b/component/viewer/html/impl/src/test/resources/images/Customer.gif
----------------------------------------------------------------------
diff --git a/component/viewer/html/impl/src/test/resources/images/Customer.gif b/component/viewer/html/impl/src/test/resources/images/Customer.gif
deleted file mode 100644
index dde9be8..0000000
Binary files a/component/viewer/html/impl/src/test/resources/images/Customer.gif and /dev/null differ
http://git-wip-us.apache.org/repos/asf/isis/blob/91a8000b/component/viewer/html/impl/src/test/resources/images/Service.png
----------------------------------------------------------------------
diff --git a/component/viewer/html/impl/src/test/resources/images/Service.png b/component/viewer/html/impl/src/test/resources/images/Service.png
deleted file mode 100644
index 6e52db7..0000000
Binary files a/component/viewer/html/impl/src/test/resources/images/Service.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/isis/blob/91a8000b/component/viewer/html/monitoring/pom.xml
----------------------------------------------------------------------
diff --git a/component/viewer/html/monitoring/pom.xml b/component/viewer/html/monitoring/pom.xml
deleted file mode 100644
index 32cb724..0000000
--- a/component/viewer/html/monitoring/pom.xml
+++ /dev/null
@@ -1,51 +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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.isis.viewer</groupId>
- <artifactId>isis-viewer-html</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>isis-viewer-html-monitoring</artifactId>
- <name>Isis HTML Viewer Monitoring</name>
-
- <properties>
- </properties>
-
- <url>http://isis.apache.org/${relativeUrl}</url>
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-runtime</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-servlet_2.5_spec</artifactId>
- <scope>provided</scope>
- </dependency>
-
- </dependencies>
-</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/91a8000b/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/MonitorServlet.java
----------------------------------------------------------------------
diff --git a/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/MonitorServlet.java b/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/MonitorServlet.java
deleted file mode 100644
index 1642a84..0000000
--- a/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/MonitorServlet.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * 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.viewer.html.monitoring;
-
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.net.URLDecoder;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.isis.viewer.html.monitoring.servermonitor.MonitorListenerImpl;
-
-public class MonitorServlet extends HttpServlet {
- private static final long serialVersionUID = 1L;
- private MonitorListenerImpl monitor;
-
- @Override
- protected void doGet(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException {
- final String queryString = request.getQueryString();
- final String query = queryString == null ? "Overview" : URLDecoder.decode(queryString, "UTF-8");
- response.setContentType("text/html");
- final PrintWriter writer = new PrintWriter(new OutputStreamWriter(response.getOutputStream()));
- if (query.equals("Sessions")) {
- writer.println("<HTML><HEAD><TITLE>NOF System Monitor - " + "Sessions" + "</TITLE></HEAD>");
- writer.println("<BODY>");
-
- writer.println("<h1>" + "Sessions" + "</h1>");
- writer.println("<pre>");
- writer.println(listSessions());
- writer.println("</pre>");
- writer.println("</BODY></HTML>");
- } else {
- monitor.writeHtmlPage(query, writer);
- }
- writer.flush();
- }
-
- private static String listSessions() {
- final StringBuffer str = new StringBuffer();
- /*
- * final Iterator<?> it = SessionAccess.getSessions().iterator(); while
- * (it.hasNext()) { final HttpSession session = (HttpSession) it.next();
- * final String id = session.getId(); str.append(id); str.append(" \t");
- *
- * final long creationTime = session.getCreationTime(); str.append(new
- * Date(creationTime)); str.append(" \t");
- *
- * final long lastAccessedTime = session.getLastAccessedTime();
- * str.append(new Date(lastAccessedTime)); str.append(" \t");
- *
- * final AuthenticationSession nofSession = (AuthenticationSession)
- * session.getAttribute("NOF_SESSION_ATTRIBUTE"); if (nofSession !=
- * null) { str.append(nofSession.getUserName()); }
- *
- * str.append("\n"); }
- */
- return str.toString();
- }
-
- @Override
- public void init(final ServletConfig servletConfig) throws ServletException {
- super.init(servletConfig);
- monitor = new MonitorListenerImpl();
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/91a8000b/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/WebServerMonitorInstaller.java
----------------------------------------------------------------------
diff --git a/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/WebServerMonitorInstaller.java b/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/WebServerMonitorInstaller.java
deleted file mode 100644
index bf2d9d2..0000000
--- a/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/WebServerMonitorInstaller.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.viewer.html.monitoring;
-
-import org.apache.isis.core.runtime.installerregistry.installerapi.IsisViewerInstallerAbstract;
-import org.apache.isis.core.runtime.viewer.IsisViewer;
-import org.apache.isis.core.runtime.viewer.web.WebAppSpecification;
-import org.apache.isis.core.runtime.web.EmbeddedWebViewer;
-
-public class WebServerMonitorInstaller extends IsisViewerInstallerAbstract {
-
- public WebServerMonitorInstaller() {
- super("web-monitor");
- }
-
- @Override
- public IsisViewer doCreateViewer() {
- return new EmbeddedWebViewer() {
- @Override
- public WebAppSpecification getWebAppSpecification() {
- final WebAppSpecification requirements = new WebAppSpecification();
- requirements.addServletSpecification(MonitorServlet.class, "/monitor/*");
- return requirements;
- }
- };
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/91a8000b/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/servermonitor/AbstractServerMonitor.java
----------------------------------------------------------------------
diff --git a/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/servermonitor/AbstractServerMonitor.java b/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/servermonitor/AbstractServerMonitor.java
deleted file mode 100644
index ad1e1f1..0000000
--- a/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/servermonitor/AbstractServerMonitor.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * 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.viewer.html.monitoring.servermonitor;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.net.InetAddress;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.net.SocketTimeoutException;
-import java.net.UnknownHostException;
-
-import org.apache.log4j.Logger;
-
-import org.apache.isis.core.commons.config.ConfigurationConstants;
-import org.apache.isis.core.runtime.services.InitialisationException;
-import org.apache.isis.core.runtime.system.IsisSystem;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-
-public abstract class AbstractServerMonitor {
- private static final Logger LOG = Logger.getLogger(AbstractServerMonitor.class);
- private static final String ADDRESS = ConfigurationConstants.ROOT + "monitor.address";
- private boolean acceptConnection = true;
-
- public void listen() {
- final String hostAddress = IsisContext.getConfiguration().getString(ADDRESS);
- InetAddress address;
- try {
- address = hostAddress == null ? null : InetAddress.getByName(hostAddress);
- final int port = getPort();
- final ServerSocket serverSocket = new ServerSocket(port, 2, address);
- serverSocket.setSoTimeout(5000);
- LOG.info("waiting for monitor connection on " + serverSocket);
- while (acceptConnection) {
- Socket client = null;
- try {
- client = serverSocket.accept();
- LOG.info("client connection on " + client);
- } catch (final SocketTimeoutException ignore) {
- // ignore
- continue;
- } catch (final IOException e) {
- LOG.error("request failed", e);
- continue;
- }
- try {
- handleRequest(client);
- } catch (final Exception e) {
- LOG.error("request failed", e);
- }
- }
- } catch (final UnknownHostException e) {
- throw new InitialisationException(e);
- } catch (final IOException e) {
- throw new InitialisationException(e);
- }
- }
-
- protected abstract int getPort();
-
- private void handleRequest(final Socket socket) throws IOException {
- final BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
- final PrintWriter writer = new PrintWriter(new OutputStreamWriter(socket.getOutputStream()));
- String request;
- do {
- request = reader.readLine();
- } while (handleRequest(writer, request));
- writer.close();
- reader.close();
- }
-
- public abstract void setTarget(IsisSystem system);
-
- public void shutdown() {
- acceptConnection = false;
- }
-
- protected abstract boolean handleRequest(PrintWriter writer, String request) throws IOException;
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/91a8000b/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/servermonitor/HttpServerMonitor.java
----------------------------------------------------------------------
diff --git a/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/servermonitor/HttpServerMonitor.java b/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/servermonitor/HttpServerMonitor.java
deleted file mode 100644
index 94a15a1..0000000
--- a/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/servermonitor/HttpServerMonitor.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * 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.viewer.html.monitoring.servermonitor;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.net.URLDecoder;
-import java.util.StringTokenizer;
-
-import org.apache.log4j.Logger;
-
-import org.apache.isis.core.commons.config.ConfigurationConstants;
-import org.apache.isis.core.runtime.system.IsisSystem;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-
-public class HttpServerMonitor extends AbstractServerMonitor {
- private static final Logger LOG = Logger.getLogger(HttpServerMonitor.class);
- private static final int DEFAULT_PORT = 8081;
- private static final String PORT = ConfigurationConstants.ROOT + "monitor.http.port";
- private final MonitorListenerImpl monitor = new MonitorListenerImpl();
-
- @Override
- protected int getPort() {
- return IsisContext.getConfiguration().getInteger(PORT, DEFAULT_PORT);
- }
-
- @Override
- protected boolean handleRequest(final PrintWriter writer, final String request) throws IOException {
- if (request == null || request.length() == 0) {
- LOG.info("Connection dropped");
- return false;
- }
- final StringTokenizer st = new StringTokenizer(request);
- if (st.countTokens() != 3) {
- httpErrorResponse(writer, 444, "Unparsable input " + request);
- return false;
- }
-
- final String type = st.nextToken();
- if (!type.equals("GET")) {
- httpErrorResponse(writer, 400, "Invalid method " + type);
- return false;
- }
-
- String query = st.nextToken();
- query = URLDecoder.decode(query, "UTF-8");
-
- if (query.equals("/")) {
- query = "/monitor";
- }
-
- if (query.startsWith("/monitor")) {
- query = query.substring("/monitor".length());
-
- if (query.startsWith("?")) {
- query = query.substring(1);
- }
-
- monitor.writeHtmlPage(query, writer);
- } else {
- httpErrorResponse(writer, 404, "Failed to find " + query);
-
- writer.println("[Request: HTTP/1.0 200");
- writer.println("Content-Type: text/html");
- writer.println("]");
- }
- return false;
- }
-
- private void httpErrorResponse(final PrintWriter writer, final int errorNo, final String response) {
- writer.println("HTTP/1.0 " + errorNo + " " + response);
- writer.println("Content-Type: text/html");
- writer.println("");
-
- writer.println("<HTML><HEAD><TITLE>Error " + errorNo + " - " + response + "</TITLE></HEAD>");
- writer.println("<BODY><h1>" + errorNo + " - " + response + "</h1>");
- writer.println("</BODY></HTML>");
-
- writer.flush();
- }
-
- @Override
- public void setTarget(final IsisSystem system) {
- // monitor.setTarget(system);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/91a8000b/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/servermonitor/Monitor.java
----------------------------------------------------------------------
diff --git a/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/servermonitor/Monitor.java b/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/servermonitor/Monitor.java
deleted file mode 100644
index 9f794d1..0000000
--- a/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/servermonitor/Monitor.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.viewer.html.monitoring.servermonitor;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-
-import org.apache.isis.core.commons.debug.DebuggableWithTitle;
-
-public class Monitor {
- private static final Logger LOG = Logger.getLogger(Monitor.class);
- private static List<MonitorListener> listeners = new ArrayList<MonitorListener>();
-
- public static void addListener(final MonitorListener listener) {
- listeners.add(listener);
- }
-
- public static void removeListener(final MonitorListener listener) {
- listeners.remove(listener);
- }
-
- public static void addEvent(final String category, final String message) {
- addEvent(category, message, null);
- }
-
- public static void addEvent(final String category, final String message, final DebuggableWithTitle[] debug) {
- final MonitorEvent event = new MonitorEvent(category, message, debug);
- LOG.info(event);
- dispatchEvent(event);
- }
-
- private static void dispatchEvent(final MonitorEvent event) {
- for (final MonitorListener listener : listeners) {
- listener.postEvent(event);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/91a8000b/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/servermonitor/MonitorEvent.java
----------------------------------------------------------------------
diff --git a/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/servermonitor/MonitorEvent.java b/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/servermonitor/MonitorEvent.java
deleted file mode 100644
index a1ebe62..0000000
--- a/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/servermonitor/MonitorEvent.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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.viewer.html.monitoring.servermonitor;
-
-import org.apache.isis.core.commons.debug.DebugString;
-import org.apache.isis.core.commons.debug.DebuggableWithTitle;
-
-public class MonitorEvent {
- private static int nextSerialId = 1;
- private final int serialId = nextSerialId++;
- private final String message;
- private final String category;
- private final DebugString debug;
-
- public MonitorEvent(final String category, final String message, final DebuggableWithTitle[] debugDetails) {
- this.message = message;
- this.category = category;
- debug = new DebugString();
- try {
- if (debugDetails != null) {
- for (final DebuggableWithTitle info : debugDetails) {
- debug.appendTitle(info.debugTitle());
- debug.indent();
- info.debugData(debug);
- debug.unindent();
- }
- }
- } catch (final RuntimeException e) {
- debug.appendException(e);
- }
- }
-
- public String getCategory() {
- return category;
- }
-
- public String getMessage() {
- return message;
- }
-
- public int getSerialId() {
- return serialId;
- }
-
- public String getDebug() {
- return debug.toString();
- }
-
- @Override
- public String toString() {
- return category + ": " + message;
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/91a8000b/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/servermonitor/MonitorListener.java
----------------------------------------------------------------------
diff --git a/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/servermonitor/MonitorListener.java b/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/servermonitor/MonitorListener.java
deleted file mode 100644
index 981e297..0000000
--- a/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/servermonitor/MonitorListener.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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.viewer.html.monitoring.servermonitor;
-
-public interface MonitorListener {
- void postEvent(MonitorEvent event);
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/91a8000b/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/servermonitor/MonitorListenerImpl.java
----------------------------------------------------------------------
diff --git a/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/servermonitor/MonitorListenerImpl.java b/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/servermonitor/MonitorListenerImpl.java
deleted file mode 100644
index 9f70741..0000000
--- a/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/servermonitor/MonitorListenerImpl.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * 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.viewer.html.monitoring.servermonitor;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.isis.core.commons.debug.DebugString;
-import org.apache.isis.core.commons.debug.DebuggableWithTitle;
-import org.apache.isis.core.commons.ensure.Assert;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-
-public class MonitorListenerImpl implements MonitorListener {
- private final List<MonitorEvent> requests = new ArrayList<MonitorEvent>();
-
- public MonitorListenerImpl() {
- org.apache.isis.viewer.html.monitoring.servermonitor.Monitor.addListener(this);
- }
-
- @Override
- public void postEvent(final MonitorEvent event) {
- // TODO use a stack of limited size so we have FIFO list
- if (requests.size() > 50) {
- requests.remove(0);
- }
- requests.add(event);
- }
-
- public void writeHtmlPage(final String section, final PrintWriter writer) throws IOException {
- Assert.assertNotNull(section);
- Assert.assertNotNull(writer);
- final String sectionName = section.equals("") ? "Overview" : section;
-
- writer.println("<HTML><HEAD><TITLE>NOF System Monitor - " + sectionName + "</TITLE></HEAD>");
- writer.println("<BODY>");
-
- writer.println("<h1>" + sectionName + "</h1>");
-
- final StringBuffer navigation = new StringBuffer("<p>");
- // final String[] options = target.debugSectionNames();
- final DebuggableWithTitle[] infos = IsisContext.debugSystem();
- for (int i = 0; i < infos.length; i++) {
- final String name = infos[i].debugTitle();
- appendNavigationLink(navigation, name, i > 0);
- }
- appendNavigationLink(navigation, "Requests", true);
- navigation.append("</p>");
-
- writer.println(navigation);
- writer.println("<pre>");
- if (sectionName.equals("Requests")) {
- int i = 1;
- for (final MonitorEvent event : requests) {
- writer.print("<a href=\"monitor?request=" + event.getSerialId() + "\">");
- writer.print(i++ + ". " + event);
- writer.println("</a>");
- }
- } else if (sectionName.startsWith("request=")) {
- final int requestId = Integer.valueOf(sectionName.substring("request=".length())).intValue();
- for (final MonitorEvent request : requests) {
- if (request.getSerialId() == requestId) {
- writer.println(request.getDebug());
- break;
- }
- }
- } else {
- for (final DebuggableWithTitle info : infos) {
- if (info.debugTitle().equals(sectionName)) {
- // TODO use an HTML debug string
- final DebugString debug = new DebugString();
- info.debugData(debug);
- writer.println(debug.toString());
- break;
- }
- }
- }
- writer.println("</pre>");
-
- writer.println(navigation);
- writer.println("</BODY></HTML>");
- }
-
- private void appendNavigationLink(final StringBuffer navigation, final String name, final boolean appendDivider) throws UnsupportedEncodingException {
- if (appendDivider) {
- navigation.append(" | ");
- }
- navigation.append("<a href=\"monitor?");
- navigation.append(URLEncoder.encode(name, "UTF-8"));
- navigation.append("\">");
- navigation.append(name);
- navigation.append("</a>");
- }
-
- public void writeTextPage(final String section, final PrintWriter writer) throws IOException {
- Assert.assertNotNull(section);
- Assert.assertNotNull(writer);
- final String sectionName = section.equals("") ? "Overview" : section;
-
- writer.println(sectionName);
-
- final DebuggableWithTitle[] infos = IsisContext.debugSystem();
- if (sectionName.equals("Events")) {
- int i = 1;
- for (final MonitorEvent event : requests) {
- writer.println(i++ + ". " + event);
- }
- // TODO add clause for request
- } else {
- for (final DebuggableWithTitle info : infos) {
- if (info.debugTitle().equals(sectionName)) {
- final DebugString debug = new DebugString();
- info.debugData(debug);
- writer.println(debug.toString());
- }
- }
- }
-
- writer.print("[Options: ");
- // final String[] options = target.debugSectionNames();
- for (final DebuggableWithTitle info : infos) {
- writer.print(info.debugTitle() + " ");
- }
- // writer.println();
- }
- /*
- * public void setTarget(final DebugSelection debugInfo2) { target =
- * debugInfo2; }
- */
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/91a8000b/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/servermonitor/SocketServerMonitor.java
----------------------------------------------------------------------
diff --git a/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/servermonitor/SocketServerMonitor.java b/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/servermonitor/SocketServerMonitor.java
deleted file mode 100644
index 0ff6ab7..0000000
--- a/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/servermonitor/SocketServerMonitor.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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.viewer.html.monitoring.servermonitor;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.net.URLDecoder;
-
-import org.apache.isis.core.commons.config.ConfigurationConstants;
-import org.apache.isis.core.runtime.system.IsisSystem;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-
-public class SocketServerMonitor extends AbstractServerMonitor {
- private static final int DEFAULT_PORT = 8009;
- private static final String PORT = ConfigurationConstants.ROOT + "monitor.telnet.port";
-
- private final MonitorListenerImpl monitor = new MonitorListenerImpl();
- private IsisSystem system;
-
- @Override
- protected int getPort() {
- return IsisContext.getConfiguration().getInteger(PORT, DEFAULT_PORT);
- }
-
- @Override
- protected boolean handleRequest(final PrintWriter writer, final String request) throws IOException {
- final String query = URLDecoder.decode(request, "UTF-8");
-
- if (query.equalsIgnoreCase("bye")) {
- writer.println("Disconnecting...");
- return false;
- } else if (query.equalsIgnoreCase("shutdown")) {
- writer.println("Shutting down system...");
- system.shutdown();
- exitSystem();
- return false;
- }
-
- monitor.writeTextPage(query, writer);
- writer.print("shutdown bye]\n#");
- writer.flush();
- return true;
- }
-
- @SuppressWarnings(value = "DM_EXIT")
- private void exitSystem() {
- System.exit(0);
- }
-
- @Override
- public void setTarget(final IsisSystem system) {
- this.system = system;
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/91a8000b/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/systemconsole/AWTConsole.java
----------------------------------------------------------------------
diff --git a/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/systemconsole/AWTConsole.java b/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/systemconsole/AWTConsole.java
deleted file mode 100644
index 5c4a6c3..0000000
--- a/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/systemconsole/AWTConsole.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * 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.viewer.html.monitoring.systemconsole;
-
-import java.awt.BorderLayout;
-import java.awt.Button;
-import java.awt.Dimension;
-import java.awt.Frame;
-import java.awt.Insets;
-import java.awt.Panel;
-import java.awt.Rectangle;
-import java.awt.TextArea;
-import java.awt.Toolkit;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import org.apache.log4j.Logger;
-
-import org.apache.isis.core.runtime.system.context.IsisContext;
-
-public class AWTConsole extends Frame implements ServerConsole {
- private static final long serialVersionUID = 1L;
- private final static Logger LOG = Logger.getLogger(AWTConsole.class);
- public static final String WIDTH = "isis.awt-console.width";
- public static final String HEIGHT = "isis.awt-console.height";
- public static final int DEFAULT_WIDTH = 600;
- public static final int DEFAULT_HEIGHT = 350;
- private Server server;
- private TextArea log;
- private Button quit;
-
- public AWTConsole() {
- super("Object Server Console");
- buildGUI();
- setVisible(true);
- ;
- }
-
- /**
- *
- */
- private void addButtons() {
- final Panel p = new Panel();
-
- p.setLayout(new java.awt.GridLayout(1, 0, 10, 0));
- add(p, BorderLayout.SOUTH);
- Button b;
-
- p.add(b = new Button("Blank"));
- b.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(final ActionEvent e) {
- clearLog();
- }
- });
-
- // debug
- p.add(b = new Button("Classes"));
- b.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(final ActionEvent e) {
- listClasses();
- }
- });
-
- p.add(b = new Button("Cache"));
- b.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(final ActionEvent e) {
- listCachedObjects();
- }
- });
-
- p.add(b = new Button("C/Cache"));
- b.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(final ActionEvent e) {
- clearCache();
- }
- });
-
- // quit
- p.add(quit = new Button("Quit"));
- quit.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(final ActionEvent e) {
- quit();
- }
- });
- }
-
- /**
- * LogWindow constructor comment.
- */
- private void buildGUI() {
- add(log = new TextArea());
- addButtons();
- final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
- final Dimension frameSize = new Dimension();
- final Insets insets = getInsets();
-
- frameSize.width = IsisContext.getConfiguration().getInteger(WIDTH, DEFAULT_WIDTH);
- frameSize.height = IsisContext.getConfiguration().getInteger(HEIGHT, DEFAULT_HEIGHT);
- final Rectangle bounds = new Rectangle(frameSize);
-
- bounds.x = screenSize.width - frameSize.width - insets.right;
- bounds.y = 0 + insets.top;
- setBounds(bounds);
- }
-
- private void clearCache() {
- }
-
- /**
- *
- * @param message
- * java.lang.String
- */
- private void clearLog() {
- log.setText("");
- }
-
- /**
- *
- */
- @Override
- public void close() {
- dispose();
- }
-
- @Override
- public void init(final Server server) {
- this.server = server;
- log("Console in control of " + server);
- }
-
- private void listCachedObjects() {
- /*
- * Enumeration e = server.getObjectStore().cache();
- *
- * log("Cached objects:-"); while (e.hasMoreElements()) { ObjectAdapter
- * object = (ObjectAdapter) e.nextElement();
- *
- * log(" " + object.getClassName() + "[" + (object.isResolved() ? "" :
- * "~") + object.getOid() + "] " + object.title()); } log();
- */
- }
-
- private void listClasses() {
- /*
- * try { Enumeration e = server.getObjectStore().classes();
- *
- * log("Loaded classes:-"); while (e.hasMoreElements()) {
- * ObjectSpecification object = (ObjectSpecification) e.nextElement();
- *
- * log(" " + object); } log(); } catch (ObjectStoreException e) {
- * LOG.error("Error listing classes " + e.getMessage()); }
- */
- }
-
- @Override
- public void log() {
- log.append("\n");
- }
-
- @Override
- public void log(final String message) {
- log.append(message + '\n');
- LOG.info(message);
- }
-
- /**
- *
- */
- public void quit() {
- server.shutdown();
- close();
- exitSystem();
- }
-
- private void exitSystem() {
- System.exit(0);
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/91a8000b/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/systemconsole/FileConsole.java
----------------------------------------------------------------------
diff --git a/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/systemconsole/FileConsole.java b/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/systemconsole/FileConsole.java
deleted file mode 100644
index 9e5c325..0000000
--- a/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/systemconsole/FileConsole.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.viewer.html.monitoring.systemconsole;
-
-import java.io.DataOutputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.Date;
-
-import org.apache.log4j.Logger;
-
-public class FileConsole implements ServerConsole {
- final static Logger LOG = Logger.getLogger(FileConsole.class);
- private DataOutputStream dos;
-
- @Override
- public void close() {
- }
-
- @Override
- public void init(final Server server) {
- }
-
- @Override
- public void log() {
- log("");
- }
-
- @Override
- public void log(final String message) {
- try {
- LOG.info(message);
- dos = new DataOutputStream(new FileOutputStream("log.xxx"));
- dos.writeBytes(new Date() + " " + message + '\n');
- dos.close();
- } catch (final IOException e) {
- LOG.error(e.getMessage(), e);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/91a8000b/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/systemconsole/QuitListener.java
----------------------------------------------------------------------
diff --git a/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/systemconsole/QuitListener.java b/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/systemconsole/QuitListener.java
deleted file mode 100644
index 1bb2994..0000000
--- a/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/systemconsole/QuitListener.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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.viewer.html.monitoring.systemconsole;
-
-public interface QuitListener {
- public void classes();
-
- public void clear();
-
- public void collections();
-
- public void objects();
-
- public void shutdown();
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/91a8000b/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/systemconsole/Server.java
----------------------------------------------------------------------
diff --git a/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/systemconsole/Server.java b/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/systemconsole/Server.java
deleted file mode 100644
index 9f2a181..0000000
--- a/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/systemconsole/Server.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.viewer.html.monitoring.systemconsole;
-
-public interface Server {
-
- void shutdown();
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/91a8000b/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/systemconsole/ServerConsole.java
----------------------------------------------------------------------
diff --git a/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/systemconsole/ServerConsole.java b/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/systemconsole/ServerConsole.java
deleted file mode 100644
index 216796e..0000000
--- a/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/systemconsole/ServerConsole.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.viewer.html.monitoring.systemconsole;
-
-public interface ServerConsole {
-
- void close();
-
- void init(Server server);
-
- void log();
-
- void log(String message);
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/91a8000b/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/systemconsole/ServerResponse.java
----------------------------------------------------------------------
diff --git a/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/systemconsole/ServerResponse.java b/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/systemconsole/ServerResponse.java
deleted file mode 100644
index 97b6cd5..0000000
--- a/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/systemconsole/ServerResponse.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.viewer.html.monitoring.systemconsole;
-
-import java.io.Serializable;
-
-public abstract class ServerResponse implements Serializable {
- final static long serialVersionUID = 1L;
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/91a8000b/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/systemconsole/TerminalConsole.java
----------------------------------------------------------------------
diff --git a/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/systemconsole/TerminalConsole.java b/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/systemconsole/TerminalConsole.java
deleted file mode 100644
index 7080ddb..0000000
--- a/component/viewer/html/monitoring/src/main/java/org/apache/isis/viewer/html/monitoring/systemconsole/TerminalConsole.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * 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.viewer.html.monitoring.systemconsole;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-
-import org.apache.log4j.Logger;
-
-/**
- * Marked as final because starts a thread in the {@link #TerminalConsole()
- * constructor}.
- */
-public final class TerminalConsole implements ServerConsole, Runnable {
- private static final Logger LOG = Logger.getLogger(TerminalConsole.class);
- private Server server;
- private boolean running = true;
-
- public TerminalConsole() {
- new Thread(this).start();
- }
-
- public void clear() {
- }
-
- @Override
- public void close() {
- running = false;
- }
-
- public void collections() {
- }
-
- @Override
- public void init(final Server server) {
- this.server = server;
- log("Control of " + server);
- }
-
- public void listClasses() {
- /*
- * try { Enumeration e = server.getObjectStore().classes();
- *
- * log("Loaded classes:-"); while (e.hasMoreElements()) {
- * ObjectSpecification object = (ObjectSpecification) e.nextElement();
- *
- * log(" " + object); } } catch (ObjectStoreException e) {
- * LOG.error("Error listing classes " + e.getMessage()); }
- */
- }
-
- @Override
- public void log() {
- log("");
- }
-
- @Override
- public void log(final String message) {
- LOG.info(message);
- System.out.println("> " + message);
- }
-
- public void objects() {
- }
-
- public void quit() {
- server.shutdown();
- server = null;
- running = false;
- }
-
- @Override
- public void run() {
- final BufferedReader dis = new BufferedReader(new InputStreamReader(System.in));
-
- try {
- while (running) {
- final String readLine = dis.readLine();
- if (readLine == null) {
- quit();
- continue;
- }
- final String s = readLine.toLowerCase();
-
- if (s.equals("")) {
- continue;
- } else if (s.equals("quit")) {
- quit();
- } else if (s.equals("classes")) {
- listClasses();
- } else {
- System.out.println("Commands: classes, quit");
- }
- }
- } catch (final IOException e) {
- quit();
- }
- exitSystem();
- }
-
- private void exitSystem() {
- System.exit(0);
- }
-
- public void start() {
- new Thread(this).start();
- }
-}