Package org.apache.isis.core.commons.exceptions

Examples of org.apache.isis.core.commons.exceptions.IsisException


        final Class<?> cls = object.getClass();
        try {
            final Method m = cls.getMethod("getId", new Class[0]);
            return (String) m.invoke(object, new Object[0]);
        } catch (final SecurityException e) {
            throw new IsisException(e);
        } catch (final NoSuchMethodException e) {
            final String id = object.getClass().getName();
            return id.substring(id.lastIndexOf('.') + 1);
        } catch (final IllegalArgumentException e) {
            throw new IsisException(e);
        } catch (final IllegalAccessException e) {
            throw new IsisException(e);
        } catch (final InvocationTargetException e) {
            throw new IsisException(e);
        }
    }
View Full Code Here


    @Override
    public final void init() {
        defaultRandomCodeGeneratorIfNecessary();
        addDefaultAuthenticators();
        if (authenticators.size() == 0) {
            throw new IsisException("No authenticators specified");
        }
        for (final Authenticator authenticator : authenticators) {
            authenticator.init();
        }
    }
View Full Code Here

        try {
            outputImpl.writeEncodable(object);
            final byte[] byteArray = baos.toByteArray();
            return new String(Hex.encodeHex(byteArray));
        } catch (final IOException e) {
            throw new IsisException("Failed to write object", e);
        }
    }
View Full Code Here

            bytes = Hex.decodeHex(chars);
            final ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
            final DataInputStreamExtended inputImpl = new DataInputStreamExtended(bais);
            return inputImpl.readEncodable(cls);
        } catch (final IOException ex) {
            throw new IsisException("Failed to read object", ex);
        } catch (final DecoderException ex) {
            throw new IsisException("Failed to hex decode object", ex);
        }
    }
View Full Code Here

        if (referencedAdapter == null) {
            throw new IllegalArgumentException("Can't use null to add an item to a collection");
        }
        if (readWrite()) {
            if (ownerAdapter.representsPersistent() && referencedAdapter.isTransient()) {
                throw new IsisException("can't set a reference to a transient object from a persistent one: " + ownerAdapter.titleString() + " (persistent) -> " + referencedAdapter.titleString() + " (transient)");
            }
            final CollectionAddToFacet facet = getFacet(CollectionAddToFacet.class);
            facet.add(ownerAdapter, referencedAdapter);
        }
    }
View Full Code Here

            jettyServer.start();
            if (startupMode.isForeground()) {
                jettyServer.join();
            }
        } catch (final Exception ex) {
             throw new IsisException("Unable to start Jetty server", ex);
        }
    }
View Full Code Here

        for (int i = 0; i < fields.size(); i++) {
            if (fields.get(i).getId().equals(name)) {
                return fields.get(i);
            }
        }
        throw new IsisException("Field not found: " + name);
    }
View Full Code Here

    public Object createObject() {
        try {
            final Class<?> cls = Class.forName(name);
            return cls.newInstance();
        } catch (final ClassNotFoundException e) {
            throw new IsisException(e);
        } catch (final InstantiationException e) {
            throw new IsisException(e);
        } catch (final IllegalAccessException e) {
            throw new IsisException(e);
        }
    }
View Full Code Here

        if (setterFacet == null) {
            return;
        }
        if (ownerAdapter.representsPersistent() && newReferencedAdapter != null && newReferencedAdapter.isTransient() && !newReferencedAdapter.getSpecification().isParented()) {
            // TODO: move to facet ?
            throw new IsisException("can't set a reference to a transient object from a persistent one: " + newReferencedAdapter.titleString() + " (transient)");
        }
        setterFacet.setProperty(ownerAdapter, newReferencedAdapter);
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    @Override
    public <T extends ViewModel> T newViewModelInstance(Class<T> ofClass, String memento) {
        final ObjectSpecification spec = getSpecificationLookup().loadSpecification(ofClass);
        if (!spec.containsFacet(ViewModelFacet.class)) {
            throw new IsisException("Type must be a ViewModel: " + ofClass);
        }
        final ObjectAdapter adapter = doCreateViewModelInstance(spec, memento);
        if(adapter.getOid().isViewModel()) {
            return (T)adapter.getObject();
        } else {
            throw new IsisException("Object instantiated but was not given a ViewModel Oid; please report as a possible defect in Isis: " + ofClass);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.isis.core.commons.exceptions.IsisException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.