Examples of Bridge


Examples of com.android.ide.common.rendering.api.Bridge

     */
    public static LayoutLibrary load(String layoutLibJarOsPath, ILogger log, String toolName) {

        LoadStatus status = LoadStatus.LOADING;
        String message = null;
        Bridge bridge = null;
        ILayoutBridge legacyBridge = null;
        ClassLoader classLoader = null;

        try {
            // get the URL for the file.
            File f = new File(layoutLibJarOsPath);
            if (f.isFile() == false) {
                if (log != null) {
                    log.error(null, "layoutlib.jar is missing!"); //$NON-NLS-1$
                }
            } else {
                URL[] urls;
                // TODO: The icu jar has to be in the same location as layoutlib.jar. Get rid of
                // this dependency.
                File icu4j = new File(f.getParent(), FN_ICU_JAR);
                if (icu4j.isFile()) {
                    urls = new URL[2];
                    urls[1] = icu4j.toURI().toURL();
                } else {
                    urls = new URL[1];
                }
                urls[0] = f.toURI().toURL();

                // create a class loader. Because this jar reference interfaces
                // that are in the editors plugin, it's important to provide
                // a parent class loader.
                classLoader = new URLClassLoader(urls,
                        LayoutLibrary.class.getClassLoader());

                // load the class
                Class<?> clazz = classLoader.loadClass(CLASS_BRIDGE);
                if (clazz != null) {
                    // instantiate an object of the class.
                    Constructor<?> constructor = clazz.getConstructor();
                    if (constructor != null) {
                        Object bridgeObject = constructor.newInstance();
                        if (bridgeObject instanceof Bridge) {
                            bridge = (Bridge)bridgeObject;
                        } else if (bridgeObject instanceof ILayoutBridge) {
                            legacyBridge = (ILayoutBridge) bridgeObject;
                        }
                    }
                }

                if (bridge == null && legacyBridge == null) {
                    status = LoadStatus.FAILED;
                    message = "Failed to load " + CLASS_BRIDGE; //$NON-NLS-1$
                    if (log != null) {
                        log.error(null,
                                "Failed to load " + //$NON-NLS-1$
                                CLASS_BRIDGE +
                                " from " +          //$NON-NLS-1$
                                layoutLibJarOsPath);
                    }
                } else {
                    // mark the lib as loaded, unless it's overridden below.
                    status = LoadStatus.LOADED;

                    // check the API, only if it's not a legacy bridge
                    if (bridge != null) {
                        int api = bridge.getApiLevel();
                        if (api > Bridge.API_CURRENT) {
                            status = LoadStatus.FAILED;
                            message = String.format(
                                    "This version of the rendering library is more recent than your version of %1$s. Please update %1$s", toolName);
                        }
View Full Code Here

Examples of com.bestfit.shared.Bridge

      }
    });
  }

  public void getUserMeals() {
    Bridge msg = new Bridge();
    msg.startDate = new Date();
    rpc.getUserMeals(msg, new AsyncCallback<Bridge>() {

      @Override
      public void onSuccess(Bridge result) {
View Full Code Here

Examples of com.jcloisterzone.feature.Bridge

        }
        return pluginGeometry.getBridgeArea(loc).createTransformedArea(transform1);
    }

    private void substractBridge(Area substractions, Tile tile) {
        Bridge bridge = tile.getBridge();
        if (bridge != null) {
            Area area;
            area = getArea(tile, Bridge.class, bridge.getLocation());
            substractions.add(area);
        }
    }
View Full Code Here

Examples of com.sun.messaging.bridge.service.Bridge

    public static Object getExportedService(String className, String bridgeType, Properties props) throws Exception {
        if (className == null) throw new IllegalArgumentException("null class name");
        if (bridgeType == null) throw new IllegalArgumentException("null bridge type");

        Bridge b = null;
        if (bridgeType.toUpperCase().equals(Bridge.JMS_TYPE)) {
            b = (Bridge)Class.forName("com.sun.messaging.bridge.service.jms.BridgeImpl").newInstance();
        } else if (bridgeType.toUpperCase().equals(Bridge.STOMP_TYPE)) {
            b = (Bridge)Class.forName("com.sun.messaging.bridge.service.stomp.StompBridge").newInstance();
        } else {
            throw new IllegalArgumentException("Invalid bridge type: "+bridgeType);
        }

        return  b.getExportedService(className, props);
    }
View Full Code Here

Examples of com.sun.messaging.bridge.service.Bridge

        Properties props = _bc.getBridgeConfig();

        try {

        Bridge b = null;
        String name = null;
        for (Map.Entry<String, Bridge> pair: _bridges.entrySet()) {
            b = pair.getValue();
            name = b.getName();
            String autostart = props.getProperty(
                               props.getProperty(
                               BridgeBaseContext.PROP_PREFIX)+"."+name+".autostart", "true");
            boolean doautostart = Boolean.valueOf(autostart);
            try {
View Full Code Here

Examples of com.sun.messaging.bridge.service.Bridge

     *
     */
    public synchronized void loadBridge(String name) throws Exception {
        _bc.logInfo("Loading bridge "+name, null);

        Bridge b = _bridges.get(name);
        if (b != null) {
            _bc.logInfo("Bridge "+name+" is already loaded.", null);
           throw new BridgeException(_bmr.getString(_bmr.I_BRIDGE_ALREADY_LOADED, name), Status.NOT_MODIFIED);
        }

        Properties props = _bc.getBridgeConfig();

        /*
        String activekey = props.getProperty(
                                  BridgeBaseContext.PROP_PREFIX)+".activelist";
        List<String> alist = BridgeUtil.getListProperty(activekey, props);
       
        String tmpn = null;
        boolean found = false;
        Iterator<String> itr = alist.iterator();
        while (itr.hasNext()) {
            tmpn = itr.next();
            if (tmpn.equals(name)) {
                found = true;
                break;
            }
        }
        if (!found) {
            String oldactives = props.getProperty(activekey);
            String newactives = oldactives+","+name;
            Properties p = new Properties();
            p.setProperty(activekey, newactives);
            _bc.updateBridgeConfig(p);
        }
        */

        props = _bc.getBridgeConfig();
        String type = props.getProperty(
                      props.getProperty(
                      BridgeBaseContext.PROP_PREFIX)+"."+name+".type");
        if (type == null) {
            String emsg = _bmr.getKString(_bmr.E_LOAD_BRIDGE_NO_TYPE, name);
            _bc.logError(emsg, null);
            throw new BridgeException(emsg);
        }
        type = type.toLowerCase();

        String classn = props.getProperty(
                        props.getProperty(
                        BridgeBaseContext.PROP_PREFIX)+"."+type+".class");

        if (classn == null) {
            String emsg = _bmr.getKString(_bmr.E_LOAD_BRIDGE_NO_CLASS, name);
            _bc.logError(emsg, null);
            throw new BridgeException(emsg);
        }


        b = (Bridge)Class.forName(classn).newInstance();

        if (!b.isMultipliable() && !b.getType().toLowerCase().equals(name.toLowerCase())) {
            String emsg =  _bmr.getKString(_bmr.E_BRIDGE_NAME_TYPE_NOT_SAME, name, b.getType());
            _bc.logError(emsg, null);
            throw new BridgeException(emsg);
        }

        if (DEBUG) {
            _bc.logInfo("Loaded brigde "+name+" by classloader "+
                        b.getClass().getClassLoader()+
                        "(parent:"+this.getClass().getClassLoader()+")", null);
        }

        b.setName(name);
        _bridges.put(name, b);

        _bc.logInfo("Loaded bridge "+name, null);

    }
View Full Code Here

Examples of com.sun.messaging.bridge.service.Bridge

        if (type != null &&
            !type.equals(Bridge.JMS_TYPE) && !type.equals(Bridge.STOMP_TYPE)) {
            throw new IllegalArgumentException(_bmr.getKString(_bmr.X_BRIDGE_INVALID_TYPE, type));
        }
        Bridge b = null;
        if (name != null) {
            b = _bridges.get(name);
            if (b == null) {
                throw new BridgeException(_bmr.getKString(_bmr.X_BRIDGE_NAME_NOT_FOUND, name));
            }
            if (type != null && !type.equals(b.getType())) {
                String[] eparam = new String[] {name, b.getType(), type};
                throw new  BridgeException(_bmr.getKString(_bmr.X_BRIDGE_TYPE_MISMATCH, eparam));
            }
            return startBridge(b, args);
        }

        boolean async = false;
        for (Map.Entry<String, Bridge> pair: _bridges.entrySet()) {
            b = pair.getValue();
            if (type != null && !b.getType().equals(type)) continue;

            if (!startBridge(b, args)) {
                async = true;
            }
        }
View Full Code Here

Examples of com.sun.messaging.bridge.service.Bridge

        if (type != null &&
            !type.equals(Bridge.JMS_TYPE) && !type.equals(Bridge.STOMP_TYPE)) {
            throw new IllegalArgumentException(_bmr.getKString(_bmr.X_BRIDGE_INVALID_TYPE, type));
        }
        Bridge b = null;
        if (name != null) {
            b = _bridges.get(name);
            if (b == null) {
                throw new BridgeException(_bmr.getKString(_bmr.X_BRIDGE_NAME_NOT_FOUND, name));
            }
            if (type != null && !type.equals(b.getType())) {
                String[] eparam = new String[] {name, b.getType(), type};
                throw new BridgeException(_bmr.getKString(_bmr.X_BRIDGE_TYPE_MISMATCH, eparam));
            }
            stopBridge(b, args);
            return;
        }

        for (Map.Entry<String, Bridge> pair: _bridges.entrySet()) {
             b = pair.getValue();
             if (type != null && !b.getType().equals(type)) continue;

             stopBridge(b, args);
        }
    }
View Full Code Here

Examples of com.sun.messaging.bridge.service.Bridge

            throw new IllegalArgumentException(_bmr.getKString(_bmr.X_BRIDGE_INVALID_TYPE, type));
        }
        if (name == null && type == null) {
            throw new UnsupportedOperationException(_bmr.getKString(_bmr.X_BRIDGE_PAUSE_NO_TYPE));
        }
        Bridge b = null;
        if (name != null) {
            b = _bridges.get(name);
            if (b == null) {
                throw new BridgeException(_bmr.getKString(_bmr.X_BRIDGE_NAME_NOT_FOUND, name));
            }
            if (type != null && !type.equals(b.getType())) {
                String[] eparam = new String[] {name, b.getType(), type};
                throw new BridgeException(_bmr.getKString(_bmr.X_BRIDGE_TYPE_MISMATCH, eparam));
            }
            pauseBridge(b, args);
            return;
        }

        for (Map.Entry<String, Bridge> pair: _bridges.entrySet()) {
             b = pair.getValue();
             if (type != null && !b.getType().equals(type)) continue;

             pauseBridge(b, args);
        }
    }
View Full Code Here

Examples of com.sun.messaging.bridge.service.Bridge

        }
        if (name == null && type == null) {
            throw new UnsupportedOperationException(_bmr.getKString(_bmr.X_BRIDGE_RESUME_NO_TYPE));
        }

        Bridge b = null;
        if (name != null) {
            b = _bridges.get(name);
            if (b == null) {
                throw new BridgeException(_bmr.getKString(_bmr.X_BRIDGE_NAME_NOT_FOUND, name));
            }
            if (type != null && !type.equals(b.getType())) {
                String[] eparam = new String[] {name, b.getType(), type};
                throw new BridgeException(_bmr.getKString(_bmr.X_BRIDGE_TYPE_MISMATCH, eparam));
            }
            resumeBridge(b, args);
            return;
        }

        for (Map.Entry<String, Bridge> pair: _bridges.entrySet()) {
             b = pair.getValue();
             if (type != null && !b.getType().equals(type)) continue;

             resumeBridge(b, args);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.