congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
ServicesConfig
Code IndexAdd Tabnine to your IDE (free)

How to use
ServicesConfig
in
org.granite.config.flex

Best Java code snippets using org.granite.config.flex.ServicesConfig (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
List l =
  • Codota Iconnew ArrayList()
  • Codota Iconnew LinkedList()
  • Smart code suggestions by Tabnine
}
origin: org.graniteds/granite-server-ejb

@Override
public ServiceInvoker<?> getServiceInstance(RemotingMessage request) throws ServiceException {
  String messageType = request.getClass().getName();
  String destinationId = request.getDestination();
  GraniteContext context = GraniteContext.getCurrentInstance();
  Map<String, Object> cache = context.getSessionMap();
  Destination destination = ((ServicesConfig)context.getServicesConfig()).findDestinationById(messageType, destinationId);
  String key = TideServiceInvoker.class.getName() + '.' + destinationId;
  return getServiceInvoker(cache, destination, key);
}
origin: org.graniteds/granite-server

public void initServices(ServicesConfig servicesConfig) {
  Channel channel = servicesConfig.findChannelById("graniteamf");
  if (channel == null) {
    channel = new Channel("graniteamf", "mx.messaging.channels.AMFChannel",
        new EndPoint("http://{server.name}:{server.port}/{context.root}/graniteamf/amf", "flex.messaging.endpoints.AMFEndpoint"),
        new XMap());
    servicesConfig.addChannel(channel);
  }
  
  List<Service> services = servicesConfig.findServicesByMessageType("flex.messaging.messages.RemotingMessage");
  Service service = null;
  if (services == null || services.isEmpty()) {
    service = new Service("granite-service", "flex.messaging.services.RemotingService", "flex.messaging.messages.RemotingMessage", 
        null, null, new HashMap<String, Destination>());
    servicesConfig.addService(service);
  }
  else
    service = services.get(0);
  
  service.getDestinations().put(source, buildDestination());
  
  log.info("Registered remote destination %s", source);
}
 
origin: org.ow2.kerneos.graniteds-osgi/granite-core

@Validate
public void start() {
  log.debug("Start Factory: " + toString());
  if (servicesConfig.findFactoryById(id) == null) {
    servicesConfig.addFactory(this);
    started = true;
  } else {
    log.error("Factory \"" + id + "\" already registered");
  }
}
origin: org.ow2.kerneos.graniteds-osgi/granite-core

@Validate
public void start() {
  log.debug("Start OSGiServiceSimple: " + toString());
  if (servicesConfig.findServiceById(id) == null) {
    // Clear destinations
    destinations.clear();
    servicesConfig.addService(this);
    started = true;
  } else {
    log.error("Service \"" + id + "\" already registered");
  }
}
origin: org.graniteds/granite-server

Channel channel = servicesConfig.findChannelById("graniteamf");
if (channel == null) {
  channel = new Channel("graniteamf", "mx.messaging.channels.AMFChannel", 
    new EndPoint("http://{server.name}:{server.port}/{context.root}/graniteamf/amf", "flex.messaging.endpoints.AMFEndpoint"), 
    new XMap());
  servicesConfig.addChannel(channel);
  Factory factory = servicesConfig.findFactoryById("tide-" + type + "-factory");
  if (factory == null) {
    factory = new Factory("tide-" + type + "-factory", factoryClass.getName(), factoryProperties);
    servicesConfig.addFactory(factory);
  Service service = servicesConfig.findServiceById("granite-service");
  if (service == null) {
    service = new Service("granite-service", "flex.messaging.services.RemotingService", 
    servicesConfig.addService(service);
    servicesConfig.scan(null);
  servicesConfig.addFactory(factory);
  servicesConfig.addService(service);
  servicesConfig.scan(null);
origin: org.ow2.kerneos.graniteds-osgi/granite-core

@Validate
public void start() {
  log.debug("Start OSGiChannelGranite: " + toString());
  if (servicesConfig.findChannelById(id) == null) {
    try {
      Dictionary properties = new Hashtable();
      properties.put("URI", endPoint.getUri());
      Dictionary filters = new Hashtable();
      filters.put("context", "(ID=" + context + ")");
      properties.put("requires.filters", filters);
      servlet = servletBuilder.createComponentInstance(properties);
      servicesConfig.addChannel(this);
      started = true;
    } catch (Exception e) {
      log.error("Can't create the servlet for \"" + id + "\"");
    }
  } else {
    log.error("Channel \"" + id + "\" already registered");
  }
}
origin: org.graniteds/granite-server

@Override
public boolean getChannelProperty(String channelId, String propertyName) {
  if (channelId == null)
    return false;
  Channel channel = findChannelById(channelId);
  if (channel == null) {
    log.debug("Could not get channel for channel id: %s", channelId);
    return false;
  }
  if ("legacyXmlSerialization".equals(propertyName))
    return channel.isLegacyXmlSerialization();
  else if ("legacyCollectionSerialization".equals(propertyName))
    return channel.isLegacyCollectionSerialization();
  return false;
}
 
origin: org.graniteds/granite-client

private static ServiceFactory getServiceFactory(Map<String, Object> cache, GraniteContext context, String factoryId, String key) {
  lock.lock();
  try {
    ServiceFactory factory = (ServiceFactory)cache.get(key);
    if (factory == null) {
      log.debug(">> No cached factory for: %s", factoryId);
      Factory config = context.getServicesConfig().findFactoryById(factoryId);
      if (config == null)
        config = getDefaultFactoryConfig();
      try {
        Class<? extends ServiceFactory> clazz = TypeUtil.forName(config.getClassName(), ServiceFactory.class);
        factory = clazz.newInstance();
        factory.configure(config.getProperties());
      } 
      catch (Exception e) {
        throw new ServiceException("Could not instantiate factory: " + factoryId + " of type " + config.getClassName(), e);
      }
      cache.put(key, factory);
    }
    else
      log.debug(">> Found a cached factory for: %s", factoryId);
    log.debug("<< Returning factory: %s", factory);
    return factory;
  } finally {
    lock.unlock();
  }
}
origin: org.graniteds/granite-client

public void load() {
  InputStream is = null;
  try {
    is = Thread.currentThread().getContextClassLoader().getResourceAsStream(graniteStdConfigPath);
    if (graniteConfigPath != null)
      is = Thread.currentThread().getContextClassLoader().getResourceAsStream(graniteConfigPath);
    graniteConfig = new GraniteConfig(graniteStdConfigPath, is, null, null);
    postLoad(graniteConfig);
    servicesConfig = new ServicesConfig(null, null, false);
  }
  catch (Exception e) {
    graniteConfig = null;
    servicesConfig = null;
    throw new RuntimeException("Cannot load configuration", e);
  }
  finally {
    if (is != null) try {
      is.close();
    }
    catch (IOException e) {
    }
  }
}
 
origin: org.graniteds/granite-server

public void handleScannedItem(ScannedItem item) {
  if ("class".equals(item.getExtension()) && item.getName().indexOf('$') == -1) {
    try {
      handleClass(item.loadAsClass());
    } catch (Throwable t) {
      log.error(t, "Could not load class: %s", item);
    }
  }
}
origin: org.graniteds/granite-server

private void loadConfig(InputStream configIs) throws IOException, SAXException {
  XMap doc = new XMap(configIs);
  forElement(doc);
}
origin: org.ow2.kerneos.graniteds-osgi/granite-core

@Validate
public void start() {
  log.debug("Start OSGiChannelGravity: " + toString());
  if (servicesConfig.findChannelById(id) == null) {
    try {
      Dictionary properties = new Hashtable();
      properties.put("URI", endPoint.getUri());
      Dictionary filters = new Hashtable();
      filters.put("context", "(ID=" + context + ")");
      properties.put("requires.filters", filters);
      servlet = servletBuilder.createComponentInstance(properties);
      servicesConfig.addChannel(this);
      started = true;
    } catch (Exception e) {
      log.error("Can't create the servlet for \"" + id + "\"");
    }
  } else {
    log.error("Channel \"" + id + "\" already registered");
  }
}
origin: org.ow2.kerneos.graniteds-osgi/granite-core

@Validate
public void start() {
  log.debug("Start OSGiServiceAdapter: " + toString());
  if (servicesConfig.findServiceById(id) == null) {
    servicesConfig.addService(this);
    // Clear destinations
    destinations.clear();
    this.defaultAdapter = adapter;
    started = true;
  } else {
    log.error("Service \"" + id + "\" already registered");
  }
}
origin: org.graniteds/granite-client

  protected Channel getChannel() {
    if (channel == null) {
      String channelId = context.getAMFContext().getChannelId();
      if (channelId != null)
        channel = context.getServicesConfig().findChannelById(channelId);
      if (channel == null)
        log.debug("Could not get channel for channel id: %s", channelId);
    }
    return channel;
  }
}
origin: org.graniteds/granite-server

private static ServiceFactory getServiceFactory(Map<String, Object> cache, GraniteContext context, String factoryId, String key) {
  lock.lock();
  try {
    ServiceFactory factory = (ServiceFactory)cache.get(key);
    if (factory == null) {
      log.debug(">> No cached factory for: %s", factoryId);
      Factory config = ((ServicesConfig)context.getServicesConfig()).findFactoryById(factoryId);
      if (config == null)
        config = getDefaultFactoryConfig();
      try {
        Class<? extends ServiceFactory> clazz = TypeUtil.forName(config.getClassName(), ServiceFactory.class);
        factory = clazz.newInstance();
        factory.configure(config.getProperties());
      } 
      catch (Exception e) {
        throw new ServiceException("Could not instantiate factory: " + factoryId + " of type " + config.getClassName(), e);
      }
      cache.put(key, factory);
    }
    else
      log.debug(">> Found a cached factory for: %s", factoryId);
    log.debug("<< Returning factory: %s", factory);
    return factory;
  } finally {
    lock.unlock();
  }
}
origin: org.graniteds/granite-server

ServicesConfig servicesConfig = new ServicesConfig(is, configuration, skipScan ? false : graniteConfig.getScan());
origin: org.graniteds/granite-client

public void handleScannedItem(ScannedItem item) {
  if ("class".equals(item.getExtension()) && item.getName().indexOf('$') == -1) {
    try {
      handleClass(item.loadAsClass());
    } catch (Throwable t) {
      log.error(t, "Could not load class: %s", item);
    }
  }
}
origin: org.graniteds/granite-client

private void loadConfig(InputStream configIs) throws IOException, SAXException {
  XMap doc = new XMap(configIs);
  forElement(doc);
}
origin: org.graniteds/granite-server

@Override
public ServiceInvoker<?> getServiceInstance(RemotingMessage request) throws ServiceException {
  String messageType = request.getClass().getName();
  String destinationId = request.getDestination();
  GraniteContext context = GraniteContext.getCurrentInstance();
  Map<String, Object> cache = context.getApplicationMap();
  Destination destination = ((ServicesConfig)context.getServicesConfig()).findDestinationById(messageType, destinationId);
  String key = TideServiceInvoker.class.getName() + '.' + destinationId;
  return getServiceInvoker(cache, destination, key);
}
origin: org.graniteds/granite-server

public void initServices(ServicesConfig servicesConfig) {
  Channel channel = servicesConfig.findChannelById("gravityamf");
  if (channel == null) {
    channel = new Channel("gravityamf", "org.granite.gravity.channels.GravityChannel",
        new EndPoint("http://{server.name}:{server.port}/{context.root}/gravityamf/amf", "flex.messaging.endpoints.AMFEndpoint"),
        new XMap());
    servicesConfig.addChannel(channel);
  List<Service> services = servicesConfig.findServicesByMessageType("flex.messaging.messages.AsyncMessage");
  Service service = null;
  Adapter adapter = null;
    service = new Service("gravity-service", "flex.messaging.services.MessagingService", "flex.messaging.messages.AsyncMessage", 
        adapter, adapters, new HashMap<String, Destination>());
    servicesConfig.addService(service);
org.granite.config.flexServicesConfig

Most used methods

  • findDestinationById
  • findChannelById
  • findFactoryById
  • <init>
  • addChannel
  • addFactory
  • addService
  • findServiceById
  • forElement
  • handleClass
  • loadConfig
  • scan
  • loadConfig,
  • scan,
  • scanConfig,
  • findServiceByDestination,
  • findServicesByMessageType,
  • removeChannel,
  • removeFactory,
  • removeService

Popular in Java

  • Reading from database using SQL prepared statement
  • setRequestProperty (URLConnection)
  • setContentView (Activity)
  • getSystemService (Context)
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • Kernel (java.awt.image)
  • PrintStream (java.io)
    Fake signature of an existing Java class.
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • List (java.util)
    An ordered collection (also known as a sequence). The user of this interface has precise control ove
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • 21 Best IntelliJ Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now