Search in sources :

Example 6 with InvalidName

use of org.omg.CORBA.ORBPackage.InvalidName in project ACS by ACS-Community.

the class CharacteristicModelImpl method get_all_characteristics.

/**
	 * @see alma.ACS.CharacteristicModelOperations#get_all_characteristics()
	 */
public PropertySet get_all_characteristics() {
    String[] allSeq;
    try {
        if (prefix == "")
            allSeq = dao.get_string_seq("");
        else
            allSeq = dao.get_string_seq(prefix);
        Property[] p = new Property[allSeq.length];
        for (int i = 0; i < allSeq.length; i++) {
            Any a = get_characteristic_by_name(allSeq[i]);
            p[i] = new Property(allSeq[i], a);
        }
        //dangerous methods!! 
        ORB orb = m_container.getAdvancedContainerServices().getORB();
        POA rootpoa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
        rootpoa.the_POAManager().activate();
        PropertySetImpl psetImpl = new PropertySetImpl(p);
        PropertySetPOATie psetTie = new PropertySetPOATie(psetImpl, rootpoa);
        return psetTie._this(orb);
    } catch (CDBFieldDoesNotExistEx e) {
    } catch (WrongCDBDataTypeEx e) {
    } catch (NoSuchCharacteristic e) {
    } catch (MultipleExceptions e) {
    } catch (InvalidName e) {
    } catch (AdapterInactive e) {
    } catch (NullPointerException e) {
        System.out.println(e);
    }
    throw new NO_IMPLEMENT();
}
Also used : NO_IMPLEMENT(org.omg.CORBA.NO_IMPLEMENT) POA(org.omg.PortableServer.POA) NoSuchCharacteristic(alma.ACS.NoSuchCharacteristic) AdapterInactive(org.omg.PortableServer.POAManagerPackage.AdapterInactive) Any(org.omg.CORBA.Any) PropertySetImpl(alma.ACS.jbaci.PropertySetImpl) PropertySetPOATie(org.omg.CosPropertyService.PropertySetPOATie) InvalidName(org.omg.CORBA.ORBPackage.InvalidName) CDBFieldDoesNotExistEx(alma.cdbErrType.CDBFieldDoesNotExistEx) MultipleExceptions(org.omg.CosPropertyService.MultipleExceptions) Property(org.omg.CosPropertyService.Property) ORB(org.omg.CORBA.ORB) WrongCDBDataTypeEx(alma.cdbErrType.WrongCDBDataTypeEx)

Example 7 with InvalidName

use of org.omg.CORBA.ORBPackage.InvalidName in project narayana by jbosstm.

the class OTSImpleManager method init.

private static final synchronized void init() {
    if (_current == null) {
        if (OTSImpleManager._theFactory == null) {
            /*
				 * Only check once, when the factory is first created.
				 */
            int resolver = Services.CONFIGURATION_FILE;
            boolean requireTransactionManager = false;
            if (jtsPropertyManager.getJTSEnvironmentBean().isTransactionManager()) {
                requireTransactionManager = true;
                String resolveMechanism = opPropertyManager.getOrbPortabilityEnvironmentBean().getResolveService();
                if (resolveMechanism.compareTo("NAME_SERVICE") == 0)
                    resolver = Services.NAME_SERVICE;
                else {
                    if (resolveMechanism.compareTo("BIND_CONNECT") == 0)
                        resolver = Services.BIND_CONNECT;
                }
            }
            if (requireTransactionManager) {
                try {
                    if (resolver != Services.BIND_CONNECT) {
                        String[] params = new String[1];
                        params[0] = Services.otsKind;
                        org.omg.CORBA.Object obj = ORBManager.getServices().getService(Services.transactionService, params, resolver);
                        params = null;
                        OTSImpleManager._theFactoryRef = org.omg.CosTransactions.TransactionFactoryHelper.narrow(obj);
                    } else {
                    }
                    if (OTSImpleManager._theFactoryRef == null)
                        throw new BAD_PARAM();
                } catch (InvalidName e1) {
                    jtsLogger.i18NLogger.warn_otsserverfailed(e1);
                    throw new FatalError(e1.toString(), e1);
                } catch (BAD_PARAM ex1) {
                    jtsLogger.i18NLogger.warn_otsserverfailed(ex1);
                    throw new FatalError(ex1.toString(), ex1);
                } catch (IOException e2) {
                    jtsLogger.i18NLogger.warn_otsservererror(e2);
                    throw new FatalError(e2.toString(), e2);
                } catch (SystemException e3) {
                    jtsLogger.i18NLogger.warn_otsservererror(e3);
                    throw new FatalError(e3.toString(), e3);
                } catch (UserException e4) {
                    jtsLogger.i18NLogger.warn_otsservererror(e4);
                    throw new FatalError(e4.toString(), e4);
                }
            } else {
                /* force to be local */
                OTSImpleManager._theFactory = new TransactionFactoryImple();
            }
        }
        if (OTSImpleManager._current == null) {
            try {
                OTSImpleManager._current = new CurrentImple();
                OTSImpleManager._currentRef = OTSImpleManager._current;
            } catch (Exception e) {
                OTSImpleManager._current = null;
                throw new com.arjuna.ats.arjuna.exceptions.FatalError("OTSImpleManager.current: " + e.toString(), e);
            }
        }
    }
}
Also used : BAD_PARAM(org.omg.CORBA.BAD_PARAM) FatalError(com.arjuna.ats.arjuna.exceptions.FatalError) IOException(java.io.IOException) CurrentImple(com.arjuna.ats.internal.jts.orbspecific.CurrentImple) SystemException(org.omg.CORBA.SystemException) UserException(org.omg.CORBA.UserException) IOException(java.io.IOException) FatalError(com.arjuna.ats.arjuna.exceptions.FatalError) InvalidName(org.omg.CORBA.ORBPackage.InvalidName) SystemException(org.omg.CORBA.SystemException) TransactionFactoryImple(com.arjuna.ats.internal.jts.orbspecific.TransactionFactoryImple) UserException(org.omg.CORBA.UserException)

Example 8 with InvalidName

use of org.omg.CORBA.ORBPackage.InvalidName in project narayana by jbosstm.

the class Services method getService.

public org.omg.CORBA.Object getService(String serviceName, Object[] params, int mechanism) throws org.omg.CORBA.ORBPackage.InvalidName, IOException, SystemException {
    org.omg.CORBA.Object objRef = null;
    switch(mechanism) {
        case RESOLVE_INITIAL_REFERENCES:
            {
                try {
                    objRef = _orb.orb().resolve_initial_references(serviceName);
                } catch (SystemException ex) {
                    throw ex;
                } catch (InvalidName exp) {
                    throw exp;
                } catch (Exception e) {
                    if (opLogger.logger.isTraceEnabled()) {
                        opLogger.logger.trace("Services.getService - resolve_initial_references on " + serviceName + " failed: " + e.toString());
                    }
                    throw new InvalidName();
                }
            }
            break;
        case NAME_SERVICE:
            {
                String kind = ((params == null) ? null : (String) params[0]);
                try {
                    org.omg.CORBA.Object nsRef = _orb.orb().resolve_initial_references(Services.nameService);
                    NamingContext ncRef = NamingContextHelper.narrow(nsRef);
                    // bind the Object Reference in Naming
                    NameComponent nc = new NameComponent(serviceName, kind);
                    NameComponent[] path = { nc };
                    objRef = ncRef.resolve(path);
                } catch (SystemException ex) {
                    throw ex;
                } catch (UserException e) {
                    throw new org.omg.CORBA.ORBPackage.InvalidName();
                }
            }
            break;
        case CONFIGURATION_FILE:
            {
                String cosservicesRoot = opPropertyManager.getOrbPortabilityEnvironmentBean().getInitialReferencesRoot();
                String configLocation = opPropertyManager.getOrbPortabilityEnvironmentBean().getInitialReferencesFile();
                String configFile = cosservicesRoot + File.separatorChar + configLocation;
                LineNumberReader input;
                try {
                    input = new LineNumberReader(new FileReader(configFile));
                } catch (FileNotFoundException e) {
                    if (opLogger.logger.isTraceEnabled()) {
                        opLogger.logger.trace("Services.getService could not open config file " + configFile);
                    }
                    throw new InvalidName();
                }
                String ior = null;
                try {
                    boolean finished = false;
                    while ((ior == null) && !finished) {
                        String line = input.readLine();
                        if (line == null)
                            finished = true;
                        else {
                            int occur = line.indexOf(serviceName);
                            if (// should be first on line
                            occur == 0)
                                // +1 for space separator
                                ior = line.substring(serviceName.length() + 1);
                        }
                    }
                    input.close();
                } catch (SystemException ex) {
                    input.close();
                    throw ex;
                } catch (Exception e) {
                    opLogger.i18NLogger.warn_Services_unexpectedexception("Services.getService", e);
                    input.close();
                    throw new UNKNOWN();
                }
                if (ior == null) {
                    opLogger.i18NLogger.warn_Services_servicenotfound(serviceName, configFile);
                    throw new InvalidName();
                } else {
                    try {
                        objRef = _orb.orb().string_to_object(ior);
                    } catch (Exception e) {
                        objRef = null;
                    }
                }
            }
            break;
        case FILE:
            {
                try {
                    String fileDir = opPropertyManager.getOrbPortabilityEnvironmentBean().getFileDir();
                    File f = null;
                    if (fileDir != null && fileDir.length() != 0)
                        f = new File(fileDir + File.separator + serviceName);
                    else
                        f = new File(serviceName);
                    FileInputStream ifile = new FileInputStream(f);
                    int size = (int) f.length();
                    byte[] b = new byte[size];
                    ifile.read(b);
                    ifile.close();
                    String objString = new String(b, StandardCharsets.UTF_8);
                    objRef = _orb.orb().string_to_object(objString);
                    objString = null;
                } catch (SystemException ex) {
                    throw ex;
                } catch (FileNotFoundException e) {
                    throw new InvalidName();
                }
            }
            break;
        case NAMED_CONNECT:
            {
                opLogger.i18NLogger.warn_Services_unsupportedoption("NAMED_CONNECT");
                throw new BAD_PARAM();
            }
    }
    return objRef;
}
Also used : NameComponent(org.omg.CosNaming.NameComponent) FileNotFoundException(java.io.FileNotFoundException) BAD_PARAM(org.omg.CORBA.BAD_PARAM) NamingContext(org.omg.CosNaming.NamingContext) SystemException(org.omg.CORBA.SystemException) UserException(org.omg.CORBA.UserException) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException) FileInputStream(java.io.FileInputStream) LineNumberReader(java.io.LineNumberReader) SystemException(org.omg.CORBA.SystemException) InvalidName(org.omg.CORBA.ORBPackage.InvalidName) FileReader(java.io.FileReader) UserException(org.omg.CORBA.UserException) UNKNOWN(org.omg.CORBA.UNKNOWN) File(java.io.File)

Example 9 with InvalidName

use of org.omg.CORBA.ORBPackage.InvalidName in project alliance by codice.

the class OrderMgrImplTest method setUp.

@Before
public void setUp() throws Exception {
    setupCommonMocks();
    setupOrderMgrMocks();
    try {
        setupOrb();
        orbRunThread = new Thread(() -> orb.run());
        orbRunThread.start();
    } catch (InvalidName | AdapterInactive | WrongPolicy | ServantNotActive e) {
        LOGGER.error("Unable to start the CORBA server", e);
    } catch (IOException e) {
        LOGGER.error("Unable to generate the IOR file", e);
    } catch (SecurityServiceException e) {
        LOGGER.error("Unable to setup guest security credentials", e);
    }
    String managerId = UUID.randomUUID().toString();
    orderMgr = new OrderMgrImpl();
    orderMgr.setFilterBuilder(new GeotoolsFilterBuilder());
    orderMgr.setCatalogFramework(mockCatalogFramework);
    if (!CorbaUtils.isIdActive(rootPOA, managerId.getBytes(Charset.forName(NsiliEndpoint.ENCODING)))) {
        try {
            rootPOA.activate_object_with_id(managerId.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), orderMgr);
        } catch (ServantAlreadyActive | ObjectAlreadyActive | WrongPolicy e) {
            LOGGER.error("Error activating ProductMgr: {}", e);
        }
    }
    rootPOA.create_reference_with_id(managerId.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), ProductMgrHelper.id());
}
Also used : OrderMgrImpl(org.codice.alliance.nsili.endpoint.managers.OrderMgrImpl) SecurityServiceException(ddf.security.service.SecurityServiceException) ObjectAlreadyActive(org.omg.PortableServer.POAPackage.ObjectAlreadyActive) AdapterInactive(org.omg.PortableServer.POAManagerPackage.AdapterInactive) ServantNotActive(org.omg.PortableServer.POAPackage.ServantNotActive) IOException(java.io.IOException) WrongPolicy(org.omg.PortableServer.POAPackage.WrongPolicy) InvalidName(org.omg.CORBA.ORBPackage.InvalidName) GeotoolsFilterBuilder(ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder) ServantAlreadyActive(org.omg.PortableServer.POAPackage.ServantAlreadyActive) Before(org.junit.Before)

Example 10 with InvalidName

use of org.omg.CORBA.ORBPackage.InvalidName in project alliance by codice.

the class ProductMgrImplTest method setUp.

@Before
public void setUp() throws Exception {
    setupCommonMocks();
    setupProductMgrMocks();
    try {
        setupOrb();
        orbRunThread = new Thread(() -> orb.run());
        orbRunThread.start();
    } catch (InvalidName | AdapterInactive | WrongPolicy | ServantNotActive e) {
        LOGGER.error("Unable to start the CORBA server", e);
    } catch (IOException e) {
        LOGGER.error("Unable to generate the IOR file", e);
    } catch (SecurityServiceException e) {
        LOGGER.error("Unable to setup guest security credentials", e);
    }
    String managerId = UUID.randomUUID().toString();
    productMgr = new ProductMgrImpl(null);
    productMgr.setFilterBuilder(new GeotoolsFilterBuilder());
    productMgr.setCatalogFramework(mockCatalogFramework);
    productMgr.setOutgoingValidationEnabled(false);
    if (!CorbaUtils.isIdActive(rootPOA, managerId.getBytes(Charset.forName(NsiliEndpoint.ENCODING)))) {
        try {
            rootPOA.activate_object_with_id(managerId.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), productMgr);
        } catch (ServantAlreadyActive | ObjectAlreadyActive | WrongPolicy e) {
            LOGGER.error("Error activating ProductMgr: {}", e);
        }
    }
    rootPOA.create_reference_with_id(managerId.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), ProductMgrHelper.id());
}
Also used : SecurityServiceException(ddf.security.service.SecurityServiceException) ObjectAlreadyActive(org.omg.PortableServer.POAPackage.ObjectAlreadyActive) AdapterInactive(org.omg.PortableServer.POAManagerPackage.AdapterInactive) ProductMgrImpl(org.codice.alliance.nsili.endpoint.managers.ProductMgrImpl) ServantNotActive(org.omg.PortableServer.POAPackage.ServantNotActive) IOException(java.io.IOException) WrongPolicy(org.omg.PortableServer.POAPackage.WrongPolicy) InvalidName(org.omg.CORBA.ORBPackage.InvalidName) GeotoolsFilterBuilder(ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder) ServantAlreadyActive(org.omg.PortableServer.POAPackage.ServantAlreadyActive) Before(org.junit.Before)

Aggregations

InvalidName (org.omg.CORBA.ORBPackage.InvalidName)13 IOException (java.io.IOException)9 AdapterInactive (org.omg.PortableServer.POAManagerPackage.AdapterInactive)8 ServantNotActive (org.omg.PortableServer.POAPackage.ServantNotActive)7 WrongPolicy (org.omg.PortableServer.POAPackage.WrongPolicy)7 GeotoolsFilterBuilder (ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder)6 SecurityServiceException (ddf.security.service.SecurityServiceException)6 Before (org.junit.Before)6 ObjectAlreadyActive (org.omg.PortableServer.POAPackage.ObjectAlreadyActive)5 ServantAlreadyActive (org.omg.PortableServer.POAPackage.ServantAlreadyActive)5 BAD_PARAM (org.omg.CORBA.BAD_PARAM)3 SystemException (org.omg.CORBA.SystemException)3 UserException (org.omg.CORBA.UserException)3 GroupInfoService (com.sun.corba.ee.spi.folb.GroupInfoService)2 File (java.io.File)2 FileNotFoundException (java.io.FileNotFoundException)2 FileReader (java.io.FileReader)2 LineNumberReader (java.io.LineNumberReader)2 Query (org.codice.alliance.nsili.common.GIAS.Query)2 ORB (org.omg.CORBA.ORB)2