Package de.innovationgate.wgaservices

Examples of de.innovationgate.wgaservices.WGAServiceException


    }
  }

  public void mkFSDesignDir(RemoteSession session, String path) throws WGAServiceException {
    if (!isAdminServiceEnabled()) {
            throw new WGAServiceException("Administrative services are disabled");
        }
   
    if (!isAdminSession(session)) {
      throw new WGAServiceException("You need an administrative login to access this service.");
    }
   
    WGADesignSource source = _core.getDesignManager().getDesignSources().get(WGAConfiguration.UID_DESIGNSOURCE_FILESYSTEM);
    if (source instanceof FileSystemDesignSource) {
      FileSystemDesignSource fsSource = (FileSystemDesignSource)source;
      try {
        fsSource.getDir().refresh();
        FileObject resource = fsSource.getDir().resolveFile(path);
       
        String basePath = fsSource.getDir().getURL().getPath();
        String resourcePath = resource.getURL().getPath();
        if (!resourcePath.startsWith(basePath)) {
          throw new WGAServiceException(new IllegalArgumentException("Illegal design resource path '" + path + "'."));
        }

        resource.createFolder();
      } catch (FileSystemException e) {
        throw new WGAServiceException("Creating of FSDesignDir '" + path + "' failed.", e);
      }
    }
   
  }
View Full Code Here


   
  }
 
  public DataSource getWGAConfiguration(RemoteSession session) throws WGAServiceException {
      if (!isAdminServiceEnabled()) {
            throw new WGAServiceException("Administrative services are disabled");
        }
       
        if (!isAdminSession(session)) {
            throw new WGAServiceException("You need an administrative login to access this service.");
        }
       
        try {
            ByteArrayOutputStream out = new ByteArrayOutputStream();
            WGAConfiguration.write(_core.getWgaConfiguration(), out);
            return new ByteArrayDataSource(out.toByteArray(), WGAConfiguration.class.getName(), "text/xml");
        }
        catch (Exception e) {
            throw new WGAServiceException("Cannot serialize wga configuration.", e);
        }
       
  }
View Full Code Here

       
  }

    public List<DatabaseServerInfo> retrieveContentStoreDatabaseServers(RemoteSession session) throws WGAServiceException {
            if (!isAdminServiceEnabled()) {
                throw new WGAServiceException("Administrative services are disabled");
            }
           
            if (!isAdminSession(session)) {
                throw new WGAServiceException("You need an administrative login to access this service.");
            }
           
            List<DatabaseServerInfo> infos = new ArrayList<DatabaseServerInfo>();
            try {
                Iterator<WGDatabaseServer> servers = _core.getDatabaseServers().values().iterator();
                while (servers.hasNext()) {
                    WGDatabaseServer server = servers.next();               
                    Iterator<ModuleDefinition> csTypes = server.getContentStoreTypes().iterator();
                                       
                    if (csTypes.hasNext()) {
                        DatabaseServerInfo info = new DatabaseServerInfo();
                        info.setUid(server.getUid());
                        info.setTitle(server.getTitle(Locale.ENGLISH));
                        infos.add(info);
                       
                        while (csTypes.hasNext()) {
                            ModuleDefinition csType = csTypes.next();                       
                            if (server.isDatabaseTypeCreatable((Class<? extends WGDatabaseCore>)csType.getImplementationClass())) {
                                info.getCreateableContentStoreImplemenations().add(csType.getImplementationClass().getName());                           
                            }
                        }
                    }                   
                }
            }
            catch (Exception e) {
                throw new WGAServiceException("Cannot serialize wga configuration.", e);
            }
            return infos;
    }
View Full Code Here

            return infos;
    }

    public void createDatabase(RemoteSession session, DatabaseServerInfo dbServerInfo, String implClassName, Map<String,String> options) throws WGAServiceException {
        if (!isAdminServiceEnabled()) {
            throw new WGAServiceException("Administrative services are disabled");
        }
       
        if (!isAdminSession(session)) {
            throw new WGAServiceException("You need an administrative login to access this service.");
        }
       
        Iterator<WGDatabaseServer> servers = _core.getDatabaseServers().values().iterator();
        WGDatabaseServer requestedServer = null;
        while (servers.hasNext()) {
            WGDatabaseServer server = servers.next();
            if (server.getUid().equals(dbServerInfo.getUid())) {
                requestedServer = server;
            }
        }
       
        if (requestedServer != null) {
            try {
                requestedServer.createDatabase((Class<? extends WGDatabaseCore>) _core.getLibraryLoader().loadClass(implClassName), options);
            }
            catch (Exception e) {
                throw new WGAServiceException(e);
            }
        }
       
    }
View Full Code Here

       
    }
   
    public List<DatabaseInformation> getAvailableDatabases(RemoteSession session, DatabaseServerInfo dbServerInfo, String implClassName) throws WGAServiceException {
        if (!isAdminServiceEnabled()) {
            throw new WGAServiceException("Administrative services are disabled");
        }
       
        if (!isAdminSession(session)) {
            throw new WGAServiceException("You need an administrative login to access this service.");
        }
       
        List<DatabaseInformation> result = new ArrayList<DatabaseInformation>();
       
        Iterator<WGDatabaseServer> servers = _core.getDatabaseServers().values().iterator();
        WGDatabaseServer requestedServer = null;
        while (servers.hasNext()) {
            WGDatabaseServer server = servers.next();
            if (server.getUid().equals(dbServerInfo.getUid())) {
                requestedServer = server;
            }
        }
       
        if (requestedServer != null) {
            try {
                List<de.innovationgate.webgate.api.servers.DatabaseInformation> infos = requestedServer.getAvailableDatabases((Class<? extends WGDatabaseCore>) _core.getLibraryLoader().loadClass(implClassName));
                for (de.innovationgate.webgate.api.servers.DatabaseInformation info : infos) {
                    DatabaseInformation serviceInfo = new DatabaseInformation();
                    serviceInfo.setImplementationClass(info.getImplementationClass().getName());
                    serviceInfo.setOptions(info.getOptions());
                    result.add(serviceInfo);
                }
            }
            catch (Exception e) {
                throw new WGAServiceException(e);
            }
        }
       
        return result;
    }
View Full Code Here

        return createContentStoreDump(session, dbKey, includeACL, false);
    }
   
    public DataSource createContentStoreDump(RemoteSession session, String dbKey, final boolean includeACL, final boolean includeSystemAreas) throws WGAServiceException {
        if (!isAdminServiceEnabled()) {
            throw new WGAServiceException("Administrative services are disabled");
        }
       
        if (!isAdminSession(session)) {
            throw new WGAServiceException("You need an administrative login to access this service.");
        }
       
        try {
            final WGDatabase db = retrieveAndOpenDB(session, dbKey);
            if (db != null && db.isSessionOpen()) {
                return new DataSource() {
                   
                    public OutputStream getOutputStream() throws IOException {
                        return null;
                    }
                   
                    public String getName() {
                        return "Dump '" + db.getDbReference() + "'";
                    }
                   
                    public InputStream getInputStream() throws IOException {
                        try {
                            return _core.dumpContentStore(db, "", true, _core.getLog(), includeACL, includeSystemAreas);
                        }
                        catch (WGAPIException e) {
                            IOException ioe = new IOException(e.getMessage());
                            ioe.setStackTrace(e.getStackTrace());
                           throw ioe;
                        }
                    }
                   
                    public String getContentType() {
                        return "application/zip";
                    }
                };               
            } else {
                throw new WGAServiceException("Unable to open database '" + dbKey + "'.");
            }
        }
        catch (Exception e) {
            throw new WGAServiceException("Import of content store dump failed for database '" + dbKey + "'.", e);
        }
    }
View Full Code Here

        importContentStoreDump(session, csDump, dbKey, includeACL, false);
    }
   
    public void importContentStoreDump(RemoteSession session, DataSource csDump, String dbKey, boolean includeACL, boolean includeSystemAreas) throws WGAServiceException {
        if (!isAdminServiceEnabled()) {
            throw new WGAServiceException("Administrative services are disabled");
        }
       
        if (!isAdminSession(session)) {
            throw new WGAServiceException("You need an administrative login to access this service.");
        }
       
        try {
            WGDatabase db = retrieveAndOpenDB(session, dbKey);
            if (db != null && db.isSessionOpen()) {
                _core.importContentStoreDump(new ZipInputStream(csDump.getInputStream()), db, _core.getLog(), includeACL, includeSystemAreas);
            } else {
                throw new WGAServiceException("Unable to open database '" + dbKey + "'.");
            }
            // reconnect cs
            _core.removeContentDB(dbKey);
            _core.updateContentDBs(false);
        }
        catch (Exception e) {
            throw new WGAServiceException("Import of content store dump failed for database '" + dbKey + "'.", e);
        }
    }
View Full Code Here

        }
    }

    public void updateWGAConfiguration(RemoteSession session, DataSource wgaConfiguration) throws WGAServiceException {
        if (!isAdminServiceEnabled()) {
            throw new WGAServiceException("Administrative services are disabled");
        }
       
        if (!isAdminSession(session)) {
            throw new WGAServiceException("You need an administrative login to access this service.");
        }
       
        try {
            WGAConfiguration configBean = WGAConfiguration.read(wgaConfiguration.getInputStream());
            _core.saveWgaConfiguration(configBean);
        }
        catch (Exception e) {
            throw new WGAServiceException("Update of wga configuration failed.", e);
        }
    }
View Full Code Here

        }
    }

    public List<PluginInfo> getPluginInformation(RemoteSession session) throws WGAServiceException {
        if (!isAdminServiceEnabled()) {
            throw new WGAServiceException("Administrative services are disabled");
        }
       
        if (!isAdminSession(session)) {
            throw new WGAServiceException("You need an administrative login to access this service.");
        }
       
        List<PluginInfo> result = new ArrayList<PluginInfo>();
       
        for (WGAPlugin plugin : _core.getPluginSet().getPlugins()) {
View Full Code Here

       
    }

    public Version getWGAVersion(RemoteSession session) throws WGAServiceException {
        if (!isAdminServiceEnabled()) {
            throw new WGAServiceException("Administrative services are disabled");
        }
       
        if (!isAdminSession(session)) {
            throw new WGAServiceException("You need an administrative login to access this service.");
        }
       
        Version version = new Version(WGAVersion.WGAPUBLISHER_MAJOR_VERSION, WGAVersion.WGAPUBLISHER_MINOR_VERSION,
                WGAVersion.WGAPUBLISHER_MAINTENANCE_VERSION, WGAVersion.WGAPUBLISHER_PATCH_VERSION, WGAVersion.WGAPUBLISHER_BUILD_VERSION);
       
View Full Code Here

TOP

Related Classes of de.innovationgate.wgaservices.WGAServiceException

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.