@Override public void debugData(final DebugBuilder debug) { debug.appendln("context ", this); debug.appendTitle("Threads based Contexts"); for (final Map.Entry<Thread, IsisSession> entry : sessionsByThread.entrySet()) { final Thread thread = entry.getKey(); final IsisSession data = entry.getValue(); debug.appendln(thread.toString(), data); } }
@Override public void debug(final DebugBuilder debug) { debug.appendAsHexln("hash", hashCode()); debug.appendln("context id", id); debug.appendln("accessed", DATE_FORMAT.format(new Date(getSessionOpenTime()))); debugState(debug); }
private static void simpleObject( final ObjectAdapter collectionAdapter, final DebugBuilder debugBuilder) { debugBuilder.appendln(collectionAdapter.titleString()); final ObjectSpecification objectSpec = collectionAdapter.getSpecification(); if (objectSpec.isParentedOrFreeCollection()) { final CollectionFacet facet = CollectionFacetUtils.getCollectionFacetFromSpec(collectionAdapter); int i = 1; for (final ObjectAdapter element : facet.collection(collectionAdapter)) { debugBuilder.appendln(i++ + " " + element.titleString()); } } else { // object is a regular Object try { final List<ObjectAssociation> fields = objectSpec.getAssociations(Contributed.EXCLUDED); for (int i = 0; i < fields.size(); i++) { final ObjectAssociation field = fields.get(i); final ObjectAdapter obj = field.get(collectionAdapter); final String name = field.getId(); if (obj == null) { debugBuilder.appendln(name, "null"); } else { debugBuilder.appendln(name, obj.titleString()); } } } catch (final RuntimeException e) { debugBuilder.appendException(e); } } }
@Override public void debugData(final DebugBuilder debug) { debug.appendln("Changes"); debugList(debug, changes); debug.appendln("Disposals"); debugList(debug, disposals); }
@Override public void debugData(final DebugBuilder debug) { debug.blankLine(); debug.appendln("Title", getFacet(TitleFacet.class)); final IconFacet iconFacet = getFacet(IconFacet.class); if (iconFacet != null) { debug.appendln("Icon", iconFacet); } debug.unindent(); }
private void debugList(final DebugBuilder debug, final List<ObjectAdapter> list) { debug.indent(); if (list.size() == 0) { debug.appendln("none"); } else { for (final ObjectAdapter adapter : list) { debug.appendln(adapter.toString()); } } debug.unindent(); }
@Override public void debugData(final DebugBuilder debug) { debug.appendTitle("Domain Objects"); for (final ObjectSpecId specId : persistedObjects.specifications()) { debug.appendln(specId.asString()); final ObjectStoreInstances instances = instancesFor(specId); instances.debugData(debug); } debug.unindent(); debug.appendln(); }
@Override public void debugData(final DebugBuilder debug) { facetDecoratorSet.debugData(debug); debug.appendln(); debug.appendTitle("Specifications"); final List<ObjectSpecification> specs = Lists.newArrayList(allSpecifications()); Collections.sort(specs, ObjectSpecification.COMPARATOR_SHORT_IDENTIFIER_IGNORE_CASE); for (final ObjectSpecification spec : specs) { StringBuffer str = new StringBuffer(); str.append(spec.isAbstract() ? "A" : "."); str.append(spec.isService() ? "S" : "."); str.append(ChoicesFacetUtils.hasChoices(spec) ? "B" : "."); str.append(spec.isParentedOrFreeCollection() ? "C" : "."); str.append(spec.isNotCollection() ? "O" : "."); str.append(spec.isParseable() ? "P" : "."); str.append(spec.isEncodeable() ? "E" : "."); str.append(spec.isValueOrIsParented() ? "A" : "."); final boolean hasIdentity = !(spec.isParentedOrFreeCollection() || spec.isParented() || spec.isValue()); str.append(hasIdentity ? "I" : "."); str.append(" "); str.append(spec.getFullIdentifier()); debug.appendPreformatted(spec.getShortIdentifier(), str.toString()); } }
private static void appendActionDetails( final DebugBuilder debug, final String desc, final List<ObjectAction> actions) { debug.appendln(desc); debug.indent(); for (int i = 0; i < actions.size(); i++) { actionDetails(actions.get(i), 8, i, debug); } debug.unindent(); }
/** * As {@link #graph(ObjectAdapter, AuthenticationSession)}, but appending to the provided {@link * DebugBuilder}. * * @see #graph(ObjectAdapter, AuthenticationSession) */ public static void graph( final ObjectAdapter object, final AuthenticationSession authenticationSession, final DebugBuilder debugBuilder) { simpleObject(object, debugBuilder); debugBuilder.appendln(); debugBuilder.append(object); graph(object, 0, Lists.<ObjectAdapter>newArrayList(), authenticationSession, debugBuilder); }
private void debug(final DebugBuilder debug, final Object object) { if (object instanceof DebuggableWithTitle) { final DebuggableWithTitle d = (DebuggableWithTitle) object; debug.startSection(d.debugTitle()); d.debugData(debug); debug.endSection(); } else { debug.appendln("no debug for " + object); } }
/** @see #adapter(ObjectAdapter) */ public static void adapter(final ObjectAdapter adapter, final DebugBuilder builder) { try { builder.appendln("Adapter", adapter.getClass().getName()); builder.appendln( "Class", adapter.getObject() == null ? "none" : adapter.getObject().getClass().getName()); builder.appendAsHexln("Hash", adapter.hashCode()); builder.appendln("Object", adapter.getObject()); builder.appendln("Title", adapter.titleString()); builder.appendln("Specification", adapter.getSpecification().getFullIdentifier()); builder.appendln(); builder.appendln("Icon", adapter.getIconName()); builder.appendln("OID", adapter.getOid()); builder.appendln("State", adapter.getResolveState()); builder.appendln("Version", adapter.getVersion()); } catch (final RuntimeException e) { builder.appendException(e); } }
private static void specificationMethods( final List<ObjectAction> userActions, final List<ObjectAction> explActions, final List<ObjectAction> prototypeActions, final List<ObjectAction> debugActions, final DebugBuilder debugBuilder) { if (userActions.size() == 0 && explActions.size() == 0 && prototypeActions.size() == 0 && debugActions.size() == 0) { debugBuilder.appendln("no actions..."); } else { appendActionDetails(debugBuilder, "User actions", userActions); appendActionDetails(debugBuilder, "Exploration actions", explActions); appendActionDetails(debugBuilder, "Prototype actions", prototypeActions); appendActionDetails(debugBuilder, "Debug actions", debugActions); } }
private static void graph( final ObjectAdapter adapter, final int level, final List<ObjectAdapter> ignoreAdapters, final AuthenticationSession authenticationSession, final DebugBuilder debugBuilder) { if (level > 3) { debugBuilder.appendln("..."); // only go 3 levels? } else { debugBuilder.append("\n"); if (adapter.getSpecification().isParentedOrFreeCollection()) { collectionGraph(adapter, level, ignoreAdapters, authenticationSession, debugBuilder); } else if (adapter.getSpecification().isNotCollection()) { objectGraph(adapter, level, ignoreAdapters, debugBuilder, authenticationSession); } else { debugBuilder.append("??? " + adapter); } } }
private static void specificationFields( final ObjectSpecification specification, final DebugBuilder debugBuilder) { final List<ObjectAssociation> fields = specification.getAssociations(Contributed.EXCLUDED); debugBuilder.appendln("All"); debugBuilder.indent(); for (int i = 0; i < fields.size(); i++) { debugBuilder.appendln((i + 1) + "." + fields.get(i).getId()); } debugBuilder.unindent(); final List<ObjectAssociation> fields2 = specification.getAssociations( Contributed.EXCLUDED, ObjectAssociation.Filters.VISIBLE_AT_LEAST_SOMETIMES); debugBuilder.appendln("Static"); debugBuilder.indent(); for (int i = 0; i < fields2.size(); i++) { debugBuilder.appendln((i + 1) + "." + fields2.get(i).getId()); } debugBuilder.unindent(); debugBuilder.appendln(); try { if (fields.size() == 0) { debugBuilder.appendln("none"); } else { for (int i = 0; i < fields.size(); i++) { final ObjectAssociation field = fields.get(i); debugBuilder.appendln( (i + 1) + "." + field.getId() + " (" + field.getClass().getName() + ")"); debugBuilder.indent(); final String description = field.getDescription(); if (description != null && !description.equals("")) { debugBuilder.appendln("Description", description); } final String help = field.getHelp(); if (help != null && !help.equals("")) { debugBuilder.appendln( "Help", help.substring(0, Math.min(30, help.length())) + (help.length() > 30 ? "..." : "")); } debugBuilder.appendln("ID", field.getIdentifier()); debugBuilder.appendln("Short ID", field.getId()); debugBuilder.appendln("Name", field.getName()); final String type = field.isOneToManyAssociation() ? "Collection" : field.isOneToOneAssociation() ? "Object" : "Unknown"; debugBuilder.appendln("Type", type); final ObjectSpecification fieldSpec = field.getSpecification(); final boolean hasIdentity = !(fieldSpec.isParentedOrFreeCollection() || fieldSpec.isParented() || fieldSpec.isValue()); debugBuilder.appendln("Has identity", hasIdentity); debugBuilder.appendln("Spec", fieldSpec.getFullIdentifier()); debugBuilder.appendln( "Flags", (field.isAlwaysHidden() ? "" : "Visible ") + (field.isNotPersisted() ? "Not Persisted " : " ") + (field.isMandatory() ? "Mandatory " : "")); final Class<? extends Facet>[] facets = field.getFacetTypes(); if (facets.length > 0) { debugBuilder.appendln("Facets"); debugBuilder.indent(); boolean none = true; for (final Class<? extends Facet> facet : facets) { debugBuilder.appendln(field.getFacet(facet).toString()); none = false; } if (none) { debugBuilder.appendln("none"); } debugBuilder.unindent(); } debugBuilder.appendln(field.debugData()); debugBuilder.unindent(); } } } catch (final RuntimeException e) { debugBuilder.appendException(e); } }
@Override public void debugState(final DebugBuilder debug) { debug.appendln("authenticationSession", getAuthenticationSession()); debug.appendln("persistenceSession", getPersistenceSession()); debug.appendln("transaction", getCurrentTransaction()); }
@Override public void debugAll(final DebugBuilder debug) { debug.startSection("Isis Context Snapshot"); debug.appendln(debugSnapshot); debug.endSection(); }
@Override protected void appendFixturesInstallerDebug(final DebugBuilder debug) { debug.appendln( "Fixture Installer", fixtureInstaller == null ? "none" : fixtureInstaller.getClass().getName()); }
public static void specification( final ObjectSpecification specification, final DebugBuilder debugBuilder) { try { debugBuilder.appendTitle(specification.getClass().getName()); debugBuilder.appendAsHexln("Hash code", specification.hashCode()); debugBuilder.appendln("ID", specification.getIdentifier()); debugBuilder.appendln("Full Name", specification.getFullIdentifier()); debugBuilder.appendln("Short Name", specification.getShortIdentifier()); debugBuilder.appendln("Singular Name", specification.getSingularName()); debugBuilder.appendln("Plural Name", specification.getPluralName()); debugBuilder.appendln("Description", specification.getDescription()); debugBuilder.blankLine(); debugBuilder.appendln("Features", featureList(specification)); debugBuilder.appendln( "Type", specification.isParentedOrFreeCollection() ? "Collection" : "Object"); if (specification.superclass() != null) { debugBuilder.appendln("Superclass", specification.superclass().getFullIdentifier()); } debugBuilder.appendln("Interfaces", specificationNames(specification.interfaces())); debugBuilder.appendln("Subclasses", specificationNames(specification.subclasses())); debugBuilder.blankLine(); debugBuilder.appendln("Service", specification.isService()); debugBuilder.appendln("Encodable", specification.isEncodeable()); debugBuilder.appendln("Parseable", specification.isParseable()); debugBuilder.appendln("Aggregated", specification.isValueOrIsParented()); } catch (final RuntimeException e) { debugBuilder.appendException(e); } if (specification instanceof DebuggableWithTitle) { ((DebuggableWithTitle) specification).debugData(debugBuilder); } debugBuilder.blankLine(); debugBuilder.appendln("Facets"); final Class<? extends Facet>[] facetTypes = specification.getFacetTypes(); debugBuilder.indent(); if (facetTypes.length == 0) { debugBuilder.appendln("none"); } else { for (final Class<? extends Facet> type : facetTypes) { final Facet facet = specification.getFacet(type); debugBuilder.appendln(facet.toString()); } } debugBuilder.unindent(); debugBuilder.blankLine(); debugBuilder.appendln("Fields"); debugBuilder.indent(); specificationFields(specification, debugBuilder); debugBuilder.unindent(); debugBuilder.appendln("Object Actions"); debugBuilder.indent(); specificationActionMethods(specification, debugBuilder); debugBuilder.unindent(); }
private static void actionDetails( final ObjectAction objectAction, final int indent, final int count, final DebugBuilder debugBuilder) { debugBuilder.appendln( (count + 1) + "." + objectAction.getId() + " (" + objectAction.getClass().getName() + ")"); debugBuilder.indent(); try { if (objectAction.getDescription() != null && !objectAction.getDescription().equals("")) { debugBuilder.appendln("Description", objectAction.getDescription()); } debugBuilder.appendln("ID", objectAction.getId()); debugBuilder.appendln(objectAction.debugData()); debugBuilder.appendln("On type", objectAction.getOnType()); final Class<? extends Facet>[] facets = objectAction.getFacetTypes(); if (facets.length > 0) { debugBuilder.appendln("Facets"); debugBuilder.indent(); for (final Class<? extends Facet> facet : facets) { debugBuilder.appendln(objectAction.getFacet(facet).toString()); } debugBuilder.unindent(); } final ObjectSpecification returnType = objectAction.getReturnType(); debugBuilder.appendln("Returns", returnType == null ? "VOID" : returnType.toString()); final List<ObjectActionParameter> parameters = objectAction.getParameters(); if (parameters.size() == 0) { debugBuilder.appendln("Parameters", "none"); } else { debugBuilder.appendln("Parameters"); debugBuilder.indent(); final List<ObjectActionParameter> p = objectAction.getParameters(); for (int j = 0; j < parameters.size(); j++) { debugBuilder.append(p.get(j).getName()); debugBuilder.append(" ("); debugBuilder.append(parameters.get(j).getSpecification().getFullIdentifier()); debugBuilder.appendln(")"); debugBuilder.indent(); final Class<? extends Facet>[] parameterFacets = p.get(j).getFacetTypes(); for (final Class<? extends Facet> parameterFacet : parameterFacets) { debugBuilder.appendln(p.get(j).getFacet(parameterFacet).toString()); } debugBuilder.unindent(); } debugBuilder.unindent(); } } catch (final RuntimeException e) { debugBuilder.appendException(e); } debugBuilder.unindent(); }