Package org.xmlBlaster.util

Examples of org.xmlBlaster.util.XmlBlasterException


      return getUrl();
   }

   private void parse(String url) throws XmlBlasterException {
      if (url == null) {
         throw new XmlBlasterException(this.glob, ErrorCode.RESOURCE_CONFIGURATION_ADDRESS, ME, "Your given RMI url '" + url + "' is invalid");
      }

      String urlLowerCase = url.toLowerCase();
      if (urlLowerCase.startsWith("rmi://")) {
         url = url.substring("rmi://".length());
      }
      else if (urlLowerCase.startsWith("rmi:")) {
         url = url.substring("rmi:".length());
      }

      int pos = url.indexOf(":");
      String portStr = null;
      if (pos > -1) {
         this.hostname = url.substring(0, pos);
         portStr = url.substring(pos+1);
         if (portStr != null && portStr.length() > 0) {
            pos = portStr.indexOf("/");
            if (pos > -1) {
               portStr = portStr.substring(0, pos); // strip path e.g. "rmi://myHost:8080/path/subpath"
            }
            try {
               this.port = (new Integer(portStr)).intValue();
            }
            catch (NumberFormatException e) {
               throw new XmlBlasterException(this.glob, ErrorCode.RESOURCE_CONFIGURATION_ADDRESS, ME, "Your given RMI url '" + url + "' port '" + portStr + "' is invalid");
            }
         }
      }
      else {
         this.hostname = url;
View Full Code Here


      } catch(java.net.UnknownHostException e) {
         Thread.currentThread().dumpStack();
         String txt = "The hostname [" + this.hostname + "] of url '" + getUrl() + "' is invalid, check your '-plugin/rmi/" +
                       (isLocal ? "localHostname" : "hostname") + " <ip>' setting: " + e.toString();
         log.warning(txt);
         throw new XmlBlasterException(glob, ErrorCode.RESOURCE_CONFIGURATION_ADDRESS, ME, txt);
      }
   }
View Full Code Here

    */
   public final MsgUnit[] get(AddressServer addressServer, String sessionId, QueryKeyData keyData, String querySpec) throws XmlBlasterException {
      String oid = keyData.getOid();
      if (log.isLoggable(Level.FINER)) log.finer("get(" + oid + ")");
      if (oid == null || oid.length() < 8) // "__cmd:" + 2 characters minimum
         throw new XmlBlasterException(glob, ErrorCode.USER_ILLEGALARGUMENT, ME, "Please pass a command which is not null or too short");
      // TODO: Change to use clientProperties arg1=..., arg2=...
      String[] args = (querySpec == null) ? new String[0] : new String[] { querySpec };
      return get(addressServer, sessionId, oid, args);
   }
View Full Code Here

      if (sessionId == null) {
         sessionId = this.sessionInfo.getSecuritySession().getSecretSessionId();
      }
      if (log.isLoggable(Level.FINER)) log.finer("get(" + oid + ")");
      if (oid == null || oid.length() < 8) // "__cmd:" + 2 characters minimum
         throw new XmlBlasterException(glob, ErrorCode.USER_ILLEGALARGUMENT, ME, "Please pass a command which is not null or too short");

      String cmd = CommandWrapper.stripCommand(this.glob, oid);
      if (cmd.startsWith(ContextNode.SCHEMA_JMX_DOMAIN)) { // JMX query starts with "org.xmlBlaster:"
         // ObjectName = org.xmlBlaster:nodeClass=node,node="heron"
         // org.xmlBlaster:nodeClass=node,node="heron"/action=getFreeMemStr
         // org.xmlBlaster:nodeClass=node,node="heron"/action=usage?action=usage
        
         // java  -Djmx.invoke.getters=set ... org.xmlBlaster.Main
         // org.xmlBlaster:nodeClass=node,node="heron"/action=getLastWarning?action=getLastWarning
         // org.xmlBlaster:nodeClass=node,node="heron"/action=getLastWarning
         // org.xmlBlaster:nodeClass=node,node="avalon_mycomp_com",clientClass=client,client="heron.mycomp.com",sessionClass=session,session="1"/action=getConnectionState
         Object obj = JmxWrapper.getInstance(this.glob).invokeCommand(cmd);
         StringBuffer ret = new StringBuffer(1024);
         if (obj != null) {
            if (obj instanceof MsgUnit) {
               return new MsgUnit[] { (MsgUnit)obj };
            }
            else if (obj instanceof MsgUnit[]) {
               return (MsgUnit[])obj;
            }
            else if (obj instanceof String[]) {
               String[] str = (String[])obj;
               for(int i=0; i<str.length; i++)
                  ret.append(str[i]).append("\n");
            }
            else {
               ret.append(obj);
            }
         }
         MsgUnit msgUnit = new MsgUnit("<key oid='__cmd:"+cmd+"'/>", ret.toString().getBytes(), "<qos/>");
         return new MsgUnit[] { msgUnit };
      }
     
      try {
         CommandWrapper w = new CommandWrapper(glob, oid);
         if (args != null) w.setArgs(args);
         String key = w.getThirdLevel();
         if (w.getThirdLevel().startsWith("?")) {
            key = "DEFAULT"// One handler needs to register itself with "DEFAULT"
         }
         Object obj = this.handlerMap.get(key); // e.g. "topic" or "client" or "sysprop"
         if (obj == null) {
            throw new XmlBlasterException(glob, ErrorCode.USER_ILLEGALARGUMENT, ME, "Sorry can't process your command '" + oid + "', '" + w.getThirdLevel() + "' has no registered handler (key=" + key + ")");
         }
         I_CommandHandler handler = (I_CommandHandler)obj;
         MsgUnit[] ret = handler.get(addressServer, sessionId, w);
         if (ret == null) ret = new MsgUnit[0];
         return ret;
View Full Code Here

      if (sessionId == null) {
         sessionId = this.sessionInfo.getSecuritySession().getSecretSessionId();
      }
      if (log.isLoggable(Level.FINER)) log.finer("set(" + cmd + ")");
      if (cmd == null || cmd.length() < 1)
         throw new XmlBlasterException(glob, ErrorCode.USER_ILLEGALARGUMENT, ME, "Please pass a command which is not null");
     
     
      if (cmd.startsWith(ContextNode.SCHEMA_JMX_DOMAIN)) { // JMX query starts with "org.xmlBlaster:"
         // ObjectName = org.xmlBlaster:nodeClass=node,node="heron"
         // org.xmlBlaster:nodeClass=node,node="heron"/action=getFreeMemStr
         // org.xmlBlaster:nodeClass=node,node="heron"/action=usage?action=usage
        
         // java  -Djmx.invoke.getters=set ... org.xmlBlaster.Main
         // org.xmlBlaster:nodeClass=node,node="heron"/action=getLastWarning?action=getLastWarning
         // org.xmlBlaster:nodeClass=node,node="heron"/action=getLastWarning
         // org.xmlBlaster:nodeClass=node,node="avalon_mycomp_com",clientClass=client,client="heron.mycomp.com",sessionClass=session,session="1"/action=getConnectionState
         Object obj = JmxWrapper.getInstance(this.glob).invokeCommand(cmd);
         StringBuffer ret = new StringBuffer(1024);
         if (obj != null) {
            if (obj instanceof String[]) {
               String[] str = (String[])obj;
               for(int i=0; i<str.length; i++)
                  ret.append(str[i]).append("\n");
            }
            else {
               ret.append(obj);
            }
         }
         return new SetReturn(null, ret.toString());
      }

      try {
         CommandWrapper w = new CommandWrapper(glob, cmd);
         String key = w.getThirdLevel();
         if (w.getThirdLevel().startsWith("?")) {
            key = "DEFAULT"// One handler needs to register itself with "DEFAULT"
         }
         Object obj = this.handlerMap.get(key);
         if (obj == null) {
            throw new XmlBlasterException(glob, ErrorCode.USER_ILLEGALARGUMENT, ME, "Sorry can't process your command '" + cmd + "', the third level '" + w.getThirdLevel() + "' has no registered handler (key=" + key + ")");
         }
         I_CommandHandler handler = (I_CommandHandler)obj;
         return new SetReturn(w, handler.set(addressServer, sessionId, w));
      }
      catch (XmlBlasterException e) {
View Full Code Here

   public static LoaderInfo getLoaderInfo(Object caller, String plugin, boolean exceptionOnFailure) throws XmlBlasterException {
      String ME = "ClassLoaderFactory";
      //if (log.isLoggable(Level.FINER)) log.call(ME, "Entering getLoaderInfo");
      if (plugin == null || plugin.length() < 1) {
         Thread.dumpStack();
         throw new XmlBlasterException(Global.instance(), ErrorCode.INTERNAL_ILLEGALARGUMENT, ME, "getLoaderInfo() with plugin=null");
      }

      String classResource = which(caller, plugin); // e.g. "/home/xmlblast/xmlBlaster/classes/org/xmlBlaster/protocol/corba/CorbaDriver.class"
      if (classResource == null) {
         if (exceptionOnFailure) {
            String text = "Can't find class " + plugin + ", please check your plugin name and your CLASSPATH";
            // if (log.isLoggable(Level.FINE)) log.trace(ME, text);
            throw new XmlBlasterException(Global.instance(), ErrorCode.RESOURCE_CONFIGURATION_PLUGINFAILED, ME, text);
         }
         return new LoaderInfo(plugin, "", "", "", "");
      }
      //if (log.isLoggable(Level.FINE)) log.trace(ME, "plugin '" + plugin + "' has resource path " + classResource );
View Full Code Here

      try {
         for(int ii=0; ii < stringUrls.size(); ii++) {
            url[ii] = new URL( "file", null, (String)stringUrls.get(ii) );
         }
      } catch (MalformedURLException e) {
         throw new XmlBlasterException(glob, ErrorCode.INTERNAL_UNKNOWN, ME, "Malformed Url Exception occured: ", e);
      }

      if (log.isLoggable(Level.FINE)) {
         log.fine("New Classpath as URL before creating classloader:");
         for (int ii = 0; ii < url.length; ii++) {
View Full Code Here

      this.ME = "RmiDriver" + this.glob.getLogPrefixDashed();


      org.xmlBlaster.engine.ServerScope engineGlob = (org.xmlBlaster.engine.ServerScope)glob.getObjectEntry(Constants.OBJECT_ENTRY_ServerScope);
      if (engineGlob == null)
         throw new XmlBlasterException(this.glob, ErrorCode.INTERNAL_UNKNOWN, ME + ".init", "could not retreive the ServerNodeScope. Am I really on the server side ?");
      try {
         this.authenticate = engineGlob.getAuthenticate();
         if (this.authenticate == null) {
            throw new XmlBlasterException(this.glob, ErrorCode.INTERNAL_UNKNOWN, ME + ".init", "authenticate object is null");
         }
         I_XmlBlaster xmlBlasterImpl = this.authenticate.getXmlBlaster();
         if (xmlBlasterImpl == null) {
            throw new XmlBlasterException(this.glob, ErrorCode.INTERNAL_UNKNOWN, ME + ".init", "xmlBlasterImpl object is null");
         }

         init(glob, new AddressServer(glob, getType(), glob.getId(), pluginInfo.getParameters()), this.authenticate, xmlBlasterImpl);
        
         activate();
      }
      catch (XmlBlasterException ex) {
         throw ex;
      }
      catch (Throwable ex) {
         throw new XmlBlasterException(this.glob, ErrorCode.INTERNAL_UNKNOWN, ME + ".init", "init. Could'nt initialize the driver.", ex);
      }
   }
View Full Code Here

                               " we will use this one. You could change the port with e.g. '-plugin/rmi/registryPort 1122' to run your own rmiregistry.");
               }
               catch (RemoteException e2) {
                  String text = "Port " + DEFAULT_REGISTRY_PORT + " is already in use, but does not seem to be a rmiregistry. Please can change the port with e.g. -plugin/rmi/registryPortCB=1122 : " + e.toString();
                  log.severe(text);
                  throw new XmlBlasterException(ME, text);
               }
            }
         }

         String prefix = "rmi://";
         authBindName = prefix + hostname + ":" + registryPort + "/I_AuthServer";
         authBindName = addressServer.getEnv("AuthServerUrl", authBindName).getValue();

         xmlBlasterBindName = prefix + hostname + ":" + registryPort + "/I_XmlBlaster";
         xmlBlasterBindName = addressServer.getEnv("XmlBlasterUrl", xmlBlasterBindName).getValue();
      } catch (Exception e) {
         e.printStackTrace();
         throw new XmlBlasterException("InitRmiFailed", "Could not initialize RMI registry: " + e.toString());
      }

      if (log.isLoggable(Level.FINE)) log.fine("Initialized RMI server");
   }
View Full Code Here

         authRmiServer = new AuthServerImpl(glob, this.addressServer, this.authenticate, xmlBlasterImpl);
         xmlBlasterRmiServer = new XmlBlasterImpl(glob, this.addressServer, xmlBlasterImpl);
      }
      catch (RemoteException e) {
         log.severe(e.toString());
         throw new XmlBlasterException("RmiDriverFailed", e.toString());
      }

      bindToRegistry();

      isActive = true;
View Full Code Here

TOP

Related Classes of org.xmlBlaster.util.XmlBlasterException

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.