Package com.dbxml.db.client

Examples of com.dbxml.db.client.dbXMLClient


            AdminConfig.DriverConfig[] drivers = cfg.getDrivers();
            for ( int i = 0; i < drivers.length; i++ ) {
               AdminConfig.DriverConfig driver = drivers[i];
               String lbl = driver.getLabel();
               dbXMLClient client = (dbXMLClient)Class.forName(driver.getClassName()).newInstance();
               client.getProperties().putAll(driver.getProperties());
               browser.addClient(client, lbl);
            }

            AdminConfig.FileSystemConfig[] filesystems = cfg.getFileSystems();
            for ( int i = 0; i < filesystems.length; i++ ) {
View Full Code Here


* Disconnect (DISCONNECT) disconnects the Command Line from the Database.
*/

public final class Disconnect extends CommandBase {
   public void process() throws dbXMLException {
      dbXMLClient client = cl.getClient();

      PrintWriter pw = cl.getWriter();

      try {
         client.disconnect();
         pw.println("Disconnected");
      }
      finally {
         cl.setClient(null);
         cl.setProperty(CommandLine.COLLECTION, null);
View Full Code Here

* Connect (CONNECT) connects the Command Line to the Database.
*/

public class Connect extends CommandBase {
   public void process() throws dbXMLException {
      dbXMLClient client = new dbXMLClientImpl();

      client.getProperties().putAll(cl.parseProperties());

      PrintWriter pw = cl.getWriter();

      try {

         client.connect();
         cl.setClient(client);
         CollectionClient db = client.getDatabase();
         cl.setProperty(CommandLine.COLLECTION, db);
         pw.println("Connected");
      }
      catch ( Exception e ) {
         cl.setClient(null);
View Full Code Here

* Shutdown (SHUTDOWN) instructs the Server to shut down.
*/

public final class Shutdown extends CommandBase {
   public void process() throws dbXMLException {
      dbXMLClient client = cl.getClient();

      PrintWriter pw = cl.getWriter();

      int exitCode = 0;
      if ( cl.hasMoreTokens() )
         exitCode = Integer.parseInt(cl.getNextToken());
      client.shutdown(exitCode);

      try {
         client.disconnect();
         pw.println("Disconnected");
      }
      finally {
         cl.setClient(null);
         cl.setProperty(CommandLine.COLLECTION, null);
View Full Code Here

      PrintWriter pw = cl.getWriter();

      pw.println("Client: "+dbXML.VersionString);

      try {
         dbXMLClient client = cl.getClient();
         pw.println("Server: "+client.getServerVersion());
      }
      catch ( dbXMLException e ) {
         pw.println("Server: "+e.getMessage());
      }
   }
View Full Code Here

   }

   void btnConnect_actionPerformed(ActionEvent e) {
      try {
         okClicked = true;
         dbXMLClient client = (dbXMLClient)DriverClasses[cmbDriver.getSelectedIndex()].newInstance();

         PropertyInfo[] props = propertyPane.getProperties();
         for ( int i = 0; i < props.length; i++ ) {
            PropertyInfo pi = props[i];
            String value = pi.getValue();
            if ( value.trim().length() > 0 )
               client.setProperty(pi.getName(), value);
         }

         String label = txtLabel.getText();

         Admin.getInstance().browser.addClient(client, label);
View Full Code Here

      String host = url.getHost();
      int port = url.getPort();
      String path = url.getPath();

      String conID = getConnectionID(host, port, username, password);
      dbXMLClient dbClient = (dbXMLClient)clientCache.get(conID);
      if ( dbClient == null ) {
         String driver = props.getProperty(DRIVER, DEFAULT_DRIVER);
         try {
            dbClient = (dbXMLClient)Class.forName(driver).newInstance();
         }
         catch ( Exception e ) {
            throw new XMLDBException(ErrorCodes.INVALID_DATABASE, "Driver '"+driver+"' could not be instantiated");
         }

         String connection = props.getProperty(CONNECTION);
         if ( connection != null )
            dbClient.setProperty(CONNECTION, connection);

         if ( host != null && !host.equals(dbXML.DEFAULT_HOST) )
            dbClient.setProperty(dbXMLClient.HOST, host);
         if ( port != dbXML.DEFAULT_PORT )
            dbClient.setProperty(dbXMLClient.PORT, Integer.toString(port));
         if ( username != null )
            dbClient.setProperty(dbXMLClient.USER, username);
         if ( password != null )
            dbClient.setProperty(dbXMLClient.PASS, password);

         try {
            dbClient.connect();
            clientCache.put(conID, dbClient);
         }
         catch ( dbXMLException e ) {
            throw new XMLDBException(ErrorCodes.NO_SUCH_DATABASE, e.getMessage());
         }
      }

      try {
         CollectionClient colClient = dbClient.getCollection(path);
         if ( colClient != null )
            return new CollectionImpl(colClient);
         else
            throw new XMLDBException(ErrorCodes.NO_SUCH_COLLECTION, "No such Collection at '"+uri+"'");
      }
View Full Code Here

   public int doStartTag() throws JspException {
      Object obj = pageContext.getAttribute(connection);
      if ( obj == null && !(obj instanceof dbXMLClient) )
         throw new JspException("No Connection named '" + connection + "' has been declared");
      dbXMLClient client = (dbXMLClient)obj;

      try {
         CollectionClient col = client.getCollection(path);
         pageContext.setAttribute(name, col);
      }
      catch ( dbXMLException e ) {
         throw new JspException("Can't connect to Collection '" + path + "' on Connection '" + connection + "'", e);
      }
View Full Code Here

      props.put(name, value);
   }

   public int doEndTag() throws JspException {
      String conID = getConnectionID();
      dbXMLClient client = (dbXMLClient)pageContext.getSession().getAttribute(conID);
      if ( client == null ) {
         try {
            client = (dbXMLClient)Class.forName(driver).newInstance();
         }
         catch ( Exception e ) {
            throw new JspException("Driver '" + driver + "' could not be instantiated");
         }

         client.getProperties().putAll(props);

         try {
            client.connect();
            pageContext.getSession().setAttribute(conID, client);
         }
         catch ( dbXMLException e ) {
            throw new JspException("Couldn't connect to dbXML Database", e);
         }
View Full Code Here

TOP

Related Classes of com.dbxml.db.client.dbXMLClient

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.