Example usage for com.google.gwt.user.client.rpc SerializableException SerializableException

List of usage examples for com.google.gwt.user.client.rpc SerializableException SerializableException

Introduction

In this page you can find the example usage for com.google.gwt.user.client.rpc SerializableException SerializableException.

Prototype

public SerializableException(String msg) 

Source Link

Document

Constructs a serializable exception with the specified message.

Usage

From source file:edu.ucsb.eucalyptus.admin.server.EucalyptusManagement.java

License:Open Source License

private static SerializableException makeFault(String message) {
    SerializableException e = new SerializableException(message);
    LOG.error(e);/*from  w w w .  j  a va 2s.  c  om*/
    return e;
}

From source file:edu.ucsb.eucalyptus.admin.server.RemoteInfoHandler.java

License:Open Source License

public static void setVmTypes(final List<VmTypeWeb> vmTypes) throws SerializableException {
    Set<VmType> newVms = Sets.newTreeSet();
    for (VmTypeWeb vmw : vmTypes) {
        newVms.add(new VmType(vmw.getName(), vmw.getCpu(), vmw.getDisk(), vmw.getMemory()));
    }/*  w w w .j av a2 s  . c om*/
    try {
        VmTypes.update(newVms);
    } catch (EucalyptusCloudException e) {
        throw new SerializableException(e.getMessage());
    }
}

From source file:org.drools.brms.server.ServiceImplementation.java

License:Apache License

/**
 * This will create a new asset. It will be saved, but not checked in.
 * The initial state will be the draft state.
 *//*from w  w  w  . j a v  a  2  s.c o m*/
@WebRemote
@Restrict("#{identity.loggedIn}")
public String createNewRule(String ruleName, String description, String initialCategory, String initialPackage,
        String format) throws SerializableException {

    log.info("USER:" + repository.getSession().getUserID() + " CREATING new asset name [" + ruleName
            + "] in package [" + initialPackage + "]");

    try {

        PackageItem pkg = repository.loadPackage(initialPackage);
        AssetItem asset = pkg.addAsset(ruleName, description, initialCategory, format);

        applyPreBuiltTemplates(ruleName, format, asset);
        repository.save();

        return asset.getUUID();
    } catch (RulesRepositoryException e) {
        if (e.getCause() instanceof ItemExistsException) {
            return "DUPLICATE";
        } else {
            throw new SerializableException(e.getMessage());
        }
    }

}

From source file:org.drools.brms.server.ServiceImplementation.java

License:Apache License

@WebRemote
@Restrict("#{identity.loggedIn}")
public String checkinVersion(RuleAsset asset) throws SerializableException {

    log.info("USER:" + repository.getSession().getUserID() + " CHECKING IN asset: [" + asset.metaData.name
            + "] UUID: [" + asset.uuid + "]  ARCHIVED [" + asset.archived + "]");

    AssetItem repoAsset = repository.loadAssetByUUID(asset.uuid);
    if (asset.metaData.lastModifiedDate.before(repoAsset.getLastModified().getTime())) {
        throw new SerializableException(
                "This asset was saved by someone else previously, and this version will not be overwritten.");
    }/*from  ww  w  . j  a va 2 s. c  o m*/

    repoAsset.archiveItem(asset.archived);
    MetaData meta = asset.metaData;

    metaDataMapper.copyFromMetaData(meta, repoAsset);

    repoAsset.updateDateEffective(dateToCalendar(meta.dateEffective));
    repoAsset.updateDateExpired(dateToCalendar(meta.dateExpired));

    repoAsset.updateCategoryList(meta.categories);
    ContentHandler handler = ContentHandler.getHandler(repoAsset.getFormat());//new AssetContentFormatHandler();
    handler.storeAssetContent(asset, repoAsset);

    repoAsset.checkin(meta.checkinComment);

    return repoAsset.getUUID();
}

From source file:org.drools.brms.server.ServiceImplementation.java

License:Apache License

@WebRemote
@Restrict("#{identity.loggedIn}")
public byte[] exportRepository() throws SerializableException {

    log.info("USER:" + repository.getSession().getUserID() + " EXPORTING repository");

    byte[] exportedOutput = null;
    try {//  w ww.j  ava  2 s. c  o m
        exportedOutput = repository.exportRulesRepository();
    } catch (Exception e) {
        throw new SerializableException("Unable to export repository");
    }
    return exportedOutput;
}

From source file:org.drools.brms.server.ServiceImplementation.java

License:Apache License

@WebRemote
@Restrict("#{identity.loggedIn}")
public String createState(String name) throws SerializableException {
    log.info("USER:" + repository.getSession().getUserID() + " CREATING state: [" + name + "]");
    try {//from   w ww.j a v a  2 s . c o  m
        String uuid = repository.createState(name).getNode().getUUID();
        repository.save();
        return uuid;
    } catch (RepositoryException e) {
        throw new SerializableException("Unable to create the status.");
    }
}

From source file:org.drools.brms.server.ServiceImplementation.java

License:Apache License

@WebRemote
@Restrict("#{identity.loggedIn}")
public void copyOrRemoveSnapshot(String packageName, String snapshotName, boolean delete,
        String newSnapshotName) throws SerializableException {

    if (delete) {
        log.info("USER:" + repository.getSession().getUserID() + " REMOVING SNAPSHOT for package: ["
                + packageName + "] snapshot: [" + snapshotName + "]");
        repository.removePackageSnapshot(packageName, snapshotName);
    } else {//from ww w . j a va  2  s .  co  m
        if (newSnapshotName.equals("")) {
            throw new SerializableException("Need to have a new snapshot name.");
        }
        log.info("USER:" + repository.getSession().getUserID() + " COPYING SNAPSHOT for package: ["
                + packageName + "] snapshot: [" + snapshotName + "] to [" + newSnapshotName + "]");

        repository.copyPackageSnapshot(packageName, snapshotName, newSnapshotName);
    }

}

From source file:org.drools.brms.server.ServiceImplementation.java

License:Apache License

@WebRemote
@Restrict("#{identity.loggedIn}")
public void removeCategory(String categoryPath) throws SerializableException {
    log.info("USER:" + repository.getSession().getUserID() + " REMOVING CATEGORY path: [" + categoryPath + "]");

    try {//from w w w.j av a  2 s .c  om
        repository.loadCategory(categoryPath).remove();
        repository.save();
    } catch (RulesRepositoryException e) {
        throw new SerializableException(e.getMessage());
    }
}

From source file:org.drools.brms.server.ServiceImplementation.java

License:Apache License

@WebRemote
@Restrict("#{identity.loggedIn}")
public SuggestionCompletionEngine loadSuggestionCompletionEngine(String packageName)
        throws SerializableException {
    try {//  w  w  w.ja  va  2  s  .  c  o  m

        PackageItem pkg = repository.loadPackage(packageName);
        BRMSSuggestionCompletionLoader loader = new BRMSSuggestionCompletionLoader();
        return loader.getSuggestionEngine(pkg);
    } catch (RulesRepositoryException e) {
        log.error(e);
        throw new SerializableException(e.getMessage());
    }

}

From source file:org.drools.brms.server.ServiceImplementation.java

License:Apache License

@WebRemote
@Restrict("#{identity.loggedIn}")
public BuilderResult[] buildPackage(String packageUUID, String selectorConfigName)
        throws SerializableException {
    PackageItem item = repository.loadPackageByUUID(packageUUID);
    ContentPackageAssembler asm = new ContentPackageAssembler(item, selectorConfigName);
    if (asm.hasErrors()) {
        BuilderResult[] result = generateBuilderResults(asm);
        return result;
    } else {/*from w  w  w .  j av  a  2  s .  c o m*/
        try {
            ByteArrayOutputStream bout = new ByteArrayOutputStream();
            ObjectOutputStream out = new ObjectOutputStream(bout);
            out.writeObject(asm.getBinaryPackage());

            item.updateCompiledPackage(new ByteArrayInputStream(bout.toByteArray()));
            out.flush();
            out.close();

            repository.save();
        } catch (IOException e) {
            log.error(e);
            throw new SerializableException(e.getMessage());
        }

        return null;

    }
}