Package org.dmd.dmw

Examples of org.dmd.dmw.DmwNamedObjectWrapper


        break;
      case BASE:
      case NONE:
        if (request.getTargetsSize() == 1){
          DmcObjectName name          = request.getDMO().getNthTargets(0).getName();
          DmwNamedObjectWrapper wrapper   = cache.get(name);
         
          if (wrapper == null){
            response = (GetResponse) request.getErrorResponse();
            response.setResponseText("Couldn't retrieve object: " + name.getNameString());
          }
          else{
            response = request.getResponse();
            response.addObjectList(wrapper.getDmcObject());
            response.setLastResponse(true);
          }
        }
        else{
//          for(NameContainer container: request.getTargetsIterable()){
View Full Code Here


    DMPEvent event = null;
   
    if (request.isTrackingEnabled())
      logger.trace("Processing set request for: " + request.getTarget().getKeyAsString());
   
    DmwNamedObjectWrapper wrapper = theCache.get(request.getTarget().getName());
   
    if (wrapper == null){
      response = (SetResponse) request.getErrorResponse();
      response.setResponseText("Could not find object to modify: " + request.getTarget().getKeyAsString());
    }
    else{
      // TODO: validation
     
      try {
        // If anything changed in the object, applyModifier() returns true
        // and we create an event to report the changes
        if (wrapper.applyModifier(request.getModifyAttribute()))
          event = createModifyEvent(request,wrapper);
         
        response = request.getResponse();
        response.setLastResponse(true);
      } catch (Exception e) {
View Full Code Here

    CreateResponse   response  = null;
   
    if (request.isTrackingEnabled())
      logger.trace("Processing create request for: " + request.getNewObject().getConstructionClassName());

    DmwNamedObjectWrapper wrapper = (DmwNamedObjectWrapper) request.getNewObjectWrapped();
   
    if (wrapper.getObjectName() == null){
      // The object doesn't have a name, we'll try to generate one for it
      synchronized (nameGenerators) {
        NameGeneratorIF ng = nameGenerators.get(wrapper.getConstructionClassInfo());
        if (ng == null){
          // Not good, we don't have a name generator, so we can't proceed
          response = (CreateResponse) request.getErrorResponse();
          response.setResponseText("No name generator was available for objects of type: " + wrapper.getConstructionClassName());
        }
        else{
          ng.createNameForObject(wrapper);
        }
      }
    }
   
    // We attempt to resolve references in the object, this includes its class
    // information and references to other objects
    try {
      wrapper.resolveReferences(this);
    } catch (DmcValueExceptionSet e) {
      response = (CreateResponse) request.getErrorResponse();
      response.setResponseText(e.toString());
    }
   
    // We add the object to the cache - if anything goes wrong, an error response will be returned
    response = addAndComplainIfNeeded(request, wrapper);
   
    if (response == null){
      // The response will have been instantiated if we have an error condition e.g. no name generator
      response = request.getResponse();
      response.addObjectList(wrapper.getDmcObject());
    }
   
    // Fire back the response
    requestTracker.processResponse(response);
   
View Full Code Here

   
    // TODO: add code to handle tree deletion
   
    StringBuffer errors = null;
    for(NameContainer container: request.getTargetsIterable()){
      DmwNamedObjectWrapper wrapper = _delete(container.getName());
     
      if (wrapper == null){
        if (errors == null){
          errors = new StringBuffer();
          errors.append(container.getName().getNameString());
View Full Code Here

      forwardEvent(event);
  }
 
  private DmwNamedObjectWrapper _delete(DmcObjectName name){
    synchronized (theCache) {
      DmwNamedObjectWrapper wrapper = theCache.remove(name);
     
      if (wrapper != null){
        indexer.deleteFromIndices(wrapper);
       
        if (name instanceof DmcHierarchicObjectName){
          DmwHierarchicObjectWrapper hwrapper = (DmwHierarchicObjectWrapper) wrapper;
          if (hwrapper.getParentComponent() != null)
            hwrapper.getParentComponent().removeSubcomponent(hwrapper);
        }
       
        wrapper.youAreDeleted();
      }
     
      return(wrapper);
    }
  }
View Full Code Here

  @Override
  public void addObject(DmwNamedObjectWrapper obj) throws ResultException {
    synchronized (theCache) {
     
      DmwNamedObjectWrapper existing = theCache.get(obj.getObjectName());
     
      if (existing != null){
        ResultException ex = new ResultException();
        ex.addError("Duplicate object name: " + obj.getObjectName());
        ex.result.lastResult().moreMessages("Existing:\n" + existing.toOIF());
        ex.result.lastResult().moreMessages("New:\n" + obj.toOIF());
        throw(ex);
      }
     
      if (obj.getConstructionClass().getIsNamedBy().getType().getIsHierarchicName()){
View Full Code Here

  ///////////////////////////////////////////////////////////////////////////
  // DmcUncheckedOIFHandlerIF implementation

  @Override
  public void handleObject(DmcUncheckedObject uco, String infile, int lineNumber) throws ResultException, DmcValueException {
    DmwNamedObjectWrapper wrapper = null;
   
    try {
      wrapper = (DmwNamedObjectWrapper) factory.createWrapper(uco);
    } catch (ClassNotFoundException e) {
      ResultException ex = new ResultException("Unknown object class: " + uco.classes.get(0));
View Full Code Here

  // DmcNameResolverIF implementation
 
  @Override
  public DmcObject findNamedDMO(DmcObjectName name) {
    DmcObject rc = null;
    DmwNamedObjectWrapper wrapper = theCache.get(name);
   
    // If we can't find the object in the cache, fall back to the schema
    if (wrapper == null)
      rc = DmwOmni.instance().findNamedDMO(name);
    else
      rc = wrapper.getDmcObject();
   
    return(rc);
  }
View Full Code Here

TOP

Related Classes of org.dmd.dmw.DmwNamedObjectWrapper

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.